@1aboveio/skills 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/.codex-plugin/resources.json +157 -132
- package/README.md +1 -1
- package/package.json +5 -4
- package/skills/app-dev/airflow/SKILL.md +1 -1
- package/skills/app-dev/android-development/SKILL.md +1 -1
- package/skills/app-dev/app-debug/SKILL.md +1 -1
- package/skills/app-dev/better-auth/SKILL.md +1 -1
- package/skills/app-dev/data-catalog/SKILL.md +1 -1
- package/skills/app-dev/data-quality/SKILL.md +1 -1
- package/skills/app-dev/ios-foundation/SKILL.md +1 -1
- package/skills/app-dev/maestro/SKILL.md +1 -1
- package/skills/app-dev/monorepo/SKILL.md +1 -1
- package/skills/app-dev/nextjs-fullstack/SKILL.md +1 -1
- package/skills/app-dev/prisma-setup/SKILL.md +1 -1
- package/skills/app-dev/pyspark/SKILL.md +1 -1
- package/skills/app-dev/python-backend/SKILL.md +1 -1
- package/skills/app-dev/shadcn/SKILL.md +1 -1
- package/skills/app-dev/zod-v4/SKILL.md +1 -1
- package/skills/cicd/cloud-build/SKILL.md +1 -1
- package/skills/cicd/cloud-debug/SKILL.md +1 -1
- package/skills/cicd/cloud-deploy/SKILL.md +1 -1
- package/skills/cicd/docker/SKILL.md +1 -1
- package/skills/cicd/github-actions/SKILL.md +1 -1
- package/skills/cicd/github-flow/SKILL.md +1 -1
- package/skills/cicd/google-cloud/SKILL.md +1 -1
- package/skills/cicd/mergify/SKILL.md +1 -1
- package/skills/cicd/podman/SKILL.md +1 -1
- package/skills/content/article-review/SKILL.md +1 -1
- package/skills/content/article-to-image/SKILL.md +1 -1
- package/skills/content/flowchart-svg/SKILL.md +1 -1
- package/skills/content/image-gen/SKILL.md +1 -1
- package/skills/content/mermaid/SKILL.md +1 -1
- package/skills/content/wechat-article-writer/SKILL.md +1 -1
- package/skills/content/wechat-publisher/SKILL.md +1 -1
- package/skills/content/wechat-search/SKILL.md +1 -1
- package/skills/content/xai-search/SKILL.md +1 -1
- package/skills/core/distill-writing/SKILL.md +1 -1
- package/skills/core/doc-to-md/SKILL.md +1 -1
- package/skills/core/editorial-review/SKILL.md +1 -1
- package/skills/core/house-style/SKILL.md +1 -1
- package/skills/core/plain-language/SKILL.md +1 -1
- package/skills/core/polish-cn/SKILL.md +1 -1
- package/skills/core/reg-parser/SKILL.md +1 -1
- package/skills/core/terminology/SKILL.md +1 -1
- package/skills/core/write-doc/SKILL.md +1 -1
- package/skills/core/write-report/SKILL.md +1 -1
- package/skills/engineering/acceptance-design/SKILL.md +1 -1
- package/skills/engineering/better-review/SKILL.md +1 -1
- package/skills/engineering/e2e-test/SKILL.md +1 -1
- package/skills/engineering/engineering/SKILL.md +1 -1
- package/skills/engineering/engineering-runtime/SKILL.md +1 -1
- package/skills/engineering/engineering-runtime/coherence/workflow.json +14 -14
- package/skills/engineering/ensure-coverage/SKILL.md +1 -1
- package/skills/engineering/golden-path/SKILL.md +1 -1
- package/skills/engineering/harness-runtime/SKILL.md +1 -1
- package/skills/engineering/resolve-issues/SKILL.md +1 -1
- package/skills/engineering/resolve-release/SKILL.md +1 -1
- package/skills/engineering/rush-issues/SKILL.md +1 -1
- package/skills/engineering/rush-release/SKILL.md +1 -1
- package/skills/engineering/test-quality/SKILL.md +1 -1
- package/skills/risk-compliance/compliance-audit/SKILL.md +1 -1
- package/skills/risk-compliance/contract-compare/SKILL.md +1 -1
- package/skills/risk-compliance/contract-review/SKILL.md +1 -1
- package/skills/risk-compliance/doc-authenticity/SKILL.md +1 -1
- package/skills/risk-compliance/fraud-detection/SKILL.md +1 -1
- package/skills/risk-compliance/payment-analysis/SKILL.md +1 -1
- package/skills/risk-compliance/portfolio-payment-analysis/SKILL.md +1 -1
- package/skills/risk-compliance/rfi-writing/LICENSE +3 -0
- package/skills/risk-compliance/rfi-writing/SKILL.md +162 -0
- package/skills/risk-compliance/rfi-writing/references/attachments.md +76 -0
- package/skills/risk-compliance/rfi-writing/references/narrative-rules.md +97 -0
- package/skills/risk-compliance/rfi-writing/references/review-brief.md +65 -0
- package/skills/risk-compliance/rfi-writing/references/worked-example.md +24 -0
- package/skills/risk-compliance/rfi-writing/release-check.mjs +95 -0
- package/skills/risk-compliance/rfi-writing/scripts/docx-case-extract.py +122 -0
- package/skills/risk-compliance/rfi-writing/scripts/images-to-pdf.sh +118 -0
- package/skills/risk-compliance/similar-domain/SKILL.md +1 -1
- package/skills/risk-compliance/tld-detection/SKILL.md +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Review brief
|
|
2
|
+
|
|
3
|
+
Send this to a **different model from the one that drafted**. A model reviewing its own draft mostly re-agrees with it; the point of the pass is to find what the drafter could not see.
|
|
4
|
+
|
|
5
|
+
Use the host's reviewer tool with an explicit model from a **different provider family**, read-only access, and the working directory holding the draft and evidence. Use only a reviewer approved to handle the evidence. Read the result, then apply or decline each finding with a reason.
|
|
6
|
+
|
|
7
|
+
Fill the placeholders. Keep the reviewer blind to your own reasoning — hand it the draft and the evidence, not the argument you were trying to make.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Template
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
You are an independent reviewer. Work entirely in this directory: <WORKDIR>
|
|
15
|
+
|
|
16
|
+
CONTEXT
|
|
17
|
+
A payment company received a Request for Information (RFI) about a customer, UID <ID>, <NAME>, who made <WHAT>. Our compliance officer has drafted the RESPONSE to that RFI. You did not write it. Review it coldly and critically.
|
|
18
|
+
|
|
19
|
+
FILES
|
|
20
|
+
- <DRAFT.md> — the response under review. THIS IS THE THING YOU REVIEW.
|
|
21
|
+
- <CASE_TEXT.md> — verbatim text extraction of the original internal case file.
|
|
22
|
+
- <KYC.pdf> — the KYC/Sumsub report. Read with: pdftotext -layout <KYC.pdf> -
|
|
23
|
+
- <kyt_01.png ... kyt_NN.png> — the KYT report screenshots. Read them as images; they are the funding evidence.
|
|
24
|
+
- <EMAIL.png> — the correspondence with the customer.
|
|
25
|
+
|
|
26
|
+
THE DRAFTING RULES THE RESPONSE HAD TO FOLLOW
|
|
27
|
+
1. Role: the payment company's compliance officer, writing a RESPONSE to the RFI.
|
|
28
|
+
2. Lead with positive facts and omit other details only when the response remains accurate and responsive.
|
|
29
|
+
3. HARD CONSTRAINT: no claim may contradict the material, and no claim may be an inference drawn beyond it. Anything in doubt, or logically contradictory, must not be used at all.
|
|
30
|
+
3b. VOICE: the letter is written by the company in reply — first person ("our records", "we verified"), the request referred to neutrally ("the transaction in the request"), the customer in third person. No second person aimed at the reader. No internal document named as a source ("the case summary", "the internal file").
|
|
31
|
+
4. Narrative: 3-5 sentences of prose in natural paragraphs, covering spending pattern; KYC; funding as reported by KYT and any relevant confirmed action; nature of spending (based on proof if available); source of wealth (if available).
|
|
32
|
+
5. Attachments in order KYC/Sumsub, KYT, Contact email, Source of Fund, Source of Wealth — skipping unavailable ones, one PDF per type, no per-image captions.
|
|
33
|
+
6. The response must itself be compliant: it must not misrepresent, omit in a way that creates a false impression about a regulatory request, or claim verification it cannot support.
|
|
34
|
+
|
|
35
|
+
WHAT TO DO
|
|
36
|
+
Read the draft, then read ALL the evidence yourself — tables, KYC text, and every KYT screenshot. Verify every number, date, percentage, name and characterisation against the evidence.
|
|
37
|
+
|
|
38
|
+
Review on four axes:
|
|
39
|
+
A. FACTUAL MISMATCH — numbers, dates, entities, percentages, names that differ from the material.
|
|
40
|
+
B. LOGIC / CONTRADICTION — claims contradicting each other or the source; also unsupported inference presented as fact. Be strict: if a claim needs a step the material does not show, flag it.
|
|
41
|
+
C. COMPLIANCE BEHAVIOUR — misleading omission; implying verification or screening that did not happen; presenting a point-in-time check as current; suggesting clean source of funds or wealth when the file holds none; tone that reads as evasive to a reviewer holding the same evidence.
|
|
42
|
+
D. TONE, WORDING AND VOICE — phrases that create a negative impression, sound defensive, hedge, or draw attention to a weakness; awkward phrasing; and voice. Flag any narrative that reads as a memo about the customer rather than a reply from the company: no first person anywhere, second person aimed at the reader, or an internal file named as the source of a figure. Propose a positive rewrite of the same fact in the right voice.
|
|
43
|
+
|
|
44
|
+
Be adversarial and specific. Do not pad the review with praise. Do not edit any file. Do not use network tools.
|
|
45
|
+
|
|
46
|
+
OUTPUT FORMAT
|
|
47
|
+
1. VERDICT — one line: sound / fixable / unsound, and the single biggest risk.
|
|
48
|
+
2. FINDINGS — numbered, each with: axis (A/B/C/D), the exact quoted text from the draft, what the evidence actually says (quote or cite the file), severity (blocker / should-fix / polish), and a concrete replacement sentence that satisfies the rules above.
|
|
49
|
+
3. NUMBERS CHECKED — a table of each figure in the draft, its value, and where you verified it.
|
|
50
|
+
4. TONE POLISH LIST — draft phrase -> suggested phrase.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Reading the result
|
|
56
|
+
|
|
57
|
+
Expect two kinds of finding, and treat them differently.
|
|
58
|
+
|
|
59
|
+
**Verification findings** — a wrong figure, a conflation of funding and destination exposure, a PEP claim the KYT report cannot support, a point-in-time check stated as current. Apply these. They are the reviewer doing arithmetic you should have done.
|
|
60
|
+
|
|
61
|
+
**Voice findings** — the reviewer says the letter sounds like an analysis of the customer rather than a reply from the company. Revise the voice even when the facts are right.
|
|
62
|
+
|
|
63
|
+
**Omission findings** — the reviewer identifies an unanswered request or a missing fact that changes the meaning of a claim. Explain the consequence to the user. If it would leave a required answer missing or make the response misleading, flag the draft as not ready to send.
|
|
64
|
+
|
|
65
|
+
The usual resolution is to **narrow** rather than delete: scope the claim to what the material shows ("no incoming risk alerts"). When narrowing cannot resolve the issue, tell the user what evidence or answer is still needed.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Worked example: routine inquiry
|
|
2
|
+
|
|
3
|
+
This example uses invented evidence. The request asks about recorded card activity and whether its purpose is supported. The ledger lists four purchases at two demo merchants, but no invoices. A separate identity exhibit records document approval without a watchlist result. The wallet screen distinguishes incoming funds from outgoing exposure. The contact record shows a receipts request was sent, but does not record delivery or a reply.
|
|
4
|
+
|
|
5
|
+
## Narrative
|
|
6
|
+
|
|
7
|
+
> Our records show four card purchases totalling USD 860 at Demo Merchant A and Demo Merchant B. We requested receipts, but the records available for this response do not establish what was bought.
|
|
8
|
+
>
|
|
9
|
+
> The wallet screen we reviewed reports no risk alerts on incoming funds and separately records 0.18% indirect token-blacklisting exposure on the outgoing side.
|
|
10
|
+
|
|
11
|
+
## Attachment manifest
|
|
12
|
+
|
|
13
|
+
| Section | Exhibit |
|
|
14
|
+
|---|---|
|
|
15
|
+
| KYC | Separate identity exhibit: document approval recorded on 12 March 2031 for Demo Profile A |
|
|
16
|
+
| KYT report | Wallet screen, with incoming and outgoing findings kept separate |
|
|
17
|
+
| Contact email | Contact record showing that a receipts request was sent |
|
|
18
|
+
|
|
19
|
+
In a submission, provide one PDF per available type in this order. There is no separate Source of Fund or Source of Wealth exhibit in this example.
|
|
20
|
+
|
|
21
|
+
## Notes to the user
|
|
22
|
+
|
|
23
|
+
- The intake summary leaves the identity field empty, but a separate identity exhibit was supplied. Keep its own label and do not claim that the approval verifies the account or that a watchlist check passed.
|
|
24
|
+
- The merchant names and amounts describe activity, not purchase purpose. The contact record shows a request for receipts, not delivery, a reply, or receipt of evidence.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
const WEEK_MS = 7 * DAY_MS;
|
|
10
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
function readJson(path, fallback = {}) {
|
|
13
|
+
try { return JSON.parse(readFileSync(path, 'utf8')); } catch { return fallback; }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function frontmatterValue(text, key) {
|
|
17
|
+
const frontmatter = /^---\n([\s\S]*?)\n---/.exec(text)?.[1] ?? '';
|
|
18
|
+
const match = new RegExp('^' + key + ':\\s*([^\\n]+)$', 'm').exec(frontmatter);
|
|
19
|
+
return match?.[1].trim().replace(/^['"]|['"]$/g, '') ?? null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function repositoryOf(source) {
|
|
23
|
+
const value = String(source ?? '').trim();
|
|
24
|
+
const match = /^(?:git@github\.com:|https:\/\/github\.com\/)?([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?)(?:\.git)?$/.exec(value);
|
|
25
|
+
return match?.[1] ?? null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function stableVersion(value) {
|
|
29
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(String(value ?? '').trim());
|
|
30
|
+
return match ? match.slice(1).map(Number) : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function newer(left, right) {
|
|
34
|
+
for (let index = 0; index < 3; index += 1) {
|
|
35
|
+
if (left[index] !== right[index]) return left[index] > right[index];
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function writeCache(path, value) {
|
|
41
|
+
try {
|
|
42
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
43
|
+
writeFileSync(path, JSON.stringify(value));
|
|
44
|
+
} catch { /* A read-only cache must not block skill use. */ }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function main(now = Date.now()) {
|
|
48
|
+
if (process.env.ONEABOVEIO_NO_UPDATE_CHECK) return;
|
|
49
|
+
const bundle = readJson(join(resolve(here, '../../..'), 'package.json'));
|
|
50
|
+
if (bundle.name === '@1aboveio/skills' && bundle.nativeCodex?.schemaVersion === 1) return;
|
|
51
|
+
const skill = readFileSync(join(here, 'SKILL.md'), 'utf8');
|
|
52
|
+
const name = frontmatterValue(skill, 'name');
|
|
53
|
+
const localVersion = stableVersion(frontmatterValue(skill, 'release-version'));
|
|
54
|
+
if (!name || !localVersion) return;
|
|
55
|
+
|
|
56
|
+
const lock = readJson(join(process.env.HOME || homedir(), '.agents', '.skill-lock.json'));
|
|
57
|
+
const entry = lock.skills?.[name];
|
|
58
|
+
const repository = repositoryOf(entry?.sourceUrl || entry?.source);
|
|
59
|
+
if (!repository) return;
|
|
60
|
+
|
|
61
|
+
const cacheRoot = process.env.XDG_CACHE_HOME || join(process.env.HOME || homedir(), '.cache');
|
|
62
|
+
const cachePath = join(cacheRoot, '1aboveio-skills', 'release-check.json');
|
|
63
|
+
const all = readJson(cachePath);
|
|
64
|
+
const cache = all[repository] && typeof all[repository] === 'object' ? all[repository] : {};
|
|
65
|
+
|
|
66
|
+
if (!cache.lastCheck || now - cache.lastCheck >= DAY_MS) {
|
|
67
|
+
const result = spawnSync('gh', ['api', 'repos/' + repository + '/releases/latest', '--jq', '.tag_name'], {
|
|
68
|
+
encoding: 'utf8',
|
|
69
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
70
|
+
timeout: 1500,
|
|
71
|
+
});
|
|
72
|
+
cache.lastCheck = now;
|
|
73
|
+
if (result.status === 0 && stableVersion(result.stdout)) cache.latestTag = result.stdout.trim();
|
|
74
|
+
else delete cache.latestTag;
|
|
75
|
+
all[repository] = cache;
|
|
76
|
+
writeCache(cachePath, all);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const latestVersion = stableVersion(cache.latestTag);
|
|
80
|
+
if (!latestVersion || !newer(latestVersion, localVersion)) return;
|
|
81
|
+
if (cache.notifiedTag === cache.latestTag && cache.notifiedAt && now - cache.notifiedAt < WEEK_MS) return;
|
|
82
|
+
|
|
83
|
+
cache.notifiedTag = cache.latestTag;
|
|
84
|
+
cache.notifiedAt = now;
|
|
85
|
+
all[repository] = cache;
|
|
86
|
+
writeCache(cachePath, all);
|
|
87
|
+
const command = `npx skills@1.5.23 add '${repository}#${cache.latestTag}' --global --agent universal claude-code --skill ${name} --yes`;
|
|
88
|
+
process.stdout.write(
|
|
89
|
+
`UPDATE_AVAILABLE: A newer 1AboveIO skills release (${cache.latestTag}) is available; this skill is `
|
|
90
|
+
+ `v${localVersion.join('.')}. Ask once whether to refresh ${name}. On approval run \`${command}\`. `
|
|
91
|
+
+ 'The refreshed instructions apply next session. Either way, continue the current task and do not ask again this session.\n',
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
try { main(); } catch { /* Update checks are advisory and always fail silent. */ }
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Dump a Word case file as agent-readable text, and inventory its attachments.
|
|
3
|
+
|
|
4
|
+
python3 docx-case-extract.py case.docx [-o outdir]
|
|
5
|
+
|
|
6
|
+
Writes <stem>.md beside the document unless -o is given: paragraphs and tables
|
|
7
|
+
in document order, with [IMAGE word/media/imageN.png] markers where pictures sit,
|
|
8
|
+
so the narrative can be written against the sequence the author intended.
|
|
9
|
+
|
|
10
|
+
It also prints an inventory of word/media and word/embeddings. Read that section
|
|
11
|
+
before concluding a report is missing: a case file that says "Not application"
|
|
12
|
+
for KYC or AML traces may still carry the report as an embedded OLE object, and
|
|
13
|
+
an EMF/PDF icon in the page is usually a live PDF stream rather than a picture.
|
|
14
|
+
|
|
15
|
+
Why a script: every response run would otherwise rewrite this parser, and the
|
|
16
|
+
edge cases (tables, tabs, line breaks, pictures in runs) are where a hand-written
|
|
17
|
+
version silently drops content.
|
|
18
|
+
"""
|
|
19
|
+
import argparse
|
|
20
|
+
import re
|
|
21
|
+
import sys
|
|
22
|
+
import zipfile
|
|
23
|
+
from xml.etree import ElementTree as ET
|
|
24
|
+
|
|
25
|
+
W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
26
|
+
R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
27
|
+
NS = {"w": W}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def rels(z):
|
|
31
|
+
try:
|
|
32
|
+
xml = z.read("word/_rels/document.xml.rels").decode("utf8")
|
|
33
|
+
except KeyError:
|
|
34
|
+
return {}
|
|
35
|
+
return dict(re.findall(r'Id="([^"]+)"[^>]*Target="([^"]+)"', xml))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def para_text(p, relmap):
|
|
39
|
+
out = []
|
|
40
|
+
for node in p.iter():
|
|
41
|
+
tag = node.tag.split("}")[1]
|
|
42
|
+
if tag == "t":
|
|
43
|
+
out.append(node.text or "")
|
|
44
|
+
elif tag == "tab":
|
|
45
|
+
out.append("\t")
|
|
46
|
+
elif tag == "br":
|
|
47
|
+
out.append("\n")
|
|
48
|
+
elif tag == "blip":
|
|
49
|
+
out.append("[[IMAGE %s]]" % relmap.get(node.get("{%s}embed" % R), "?"))
|
|
50
|
+
elif tag == "imagedata": # legacy VML picture
|
|
51
|
+
out.append("[[IMAGE %s]]" % relmap.get(node.get("{%s}id" % R), "?"))
|
|
52
|
+
return "".join(out)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def style(p):
|
|
56
|
+
pPr = p.find("w:pPr", NS)
|
|
57
|
+
if pPr is None:
|
|
58
|
+
return None
|
|
59
|
+
s = pPr.find("w:pStyle", NS)
|
|
60
|
+
return s.get("{%s}val" % W) if s is not None else None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def extract(path):
|
|
64
|
+
z = zipfile.ZipFile(path)
|
|
65
|
+
relmap = rels(z)
|
|
66
|
+
root = ET.fromstring(z.read("word/document.xml"))
|
|
67
|
+
body = root.find("w:body", NS)
|
|
68
|
+
lines = []
|
|
69
|
+
tables = 0
|
|
70
|
+
for child in body:
|
|
71
|
+
tag = child.tag.split("}")[1]
|
|
72
|
+
if tag == "p":
|
|
73
|
+
txt = para_text(child, relmap)
|
|
74
|
+
if txt.strip() or "[[IMAGE" in txt:
|
|
75
|
+
st = style(child)
|
|
76
|
+
lines.append("## %s" % txt if st and st.lower().startswith("heading") else txt)
|
|
77
|
+
elif tag == "tbl":
|
|
78
|
+
tables += 1
|
|
79
|
+
lines.append("[TABLE %d]" % tables)
|
|
80
|
+
for tr in child.findall("w:tr", NS):
|
|
81
|
+
cells = [para_text(tc, relmap).replace("\n", " ").strip()
|
|
82
|
+
for tc in tr.findall("w:tc", NS)]
|
|
83
|
+
lines.append(" | ".join(cells))
|
|
84
|
+
lines.append("[/TABLE]")
|
|
85
|
+
media = sorted(n for n in z.namelist() if n.startswith("word/media/"))
|
|
86
|
+
embeddings = sorted(n for n in z.namelist() if n.startswith("word/embeddings/"))
|
|
87
|
+
return "\n".join(lines), media, embeddings, tables
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def main():
|
|
91
|
+
ap = argparse.ArgumentParser(description="Extract text, tables and an attachment inventory from a .docx")
|
|
92
|
+
ap.add_argument("docx")
|
|
93
|
+
ap.add_argument("-o", "--outdir", default=".")
|
|
94
|
+
args = ap.parse_args()
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
text, media, embeddings, tables = extract(args.docx)
|
|
98
|
+
except (KeyError, zipfile.BadZipFile) as exc:
|
|
99
|
+
sys.exit("error: not a readable .docx (%s)" % exc)
|
|
100
|
+
|
|
101
|
+
import os
|
|
102
|
+
stem = os.path.splitext(os.path.basename(args.docx))[0]
|
|
103
|
+
out = os.path.join(args.outdir, stem + ".md")
|
|
104
|
+
header = "# %s — extracted\n\n" % stem
|
|
105
|
+
inv = ["", "## Attachment inventory", "",
|
|
106
|
+
"- pictures in word/media: %d" % len(media)]
|
|
107
|
+
inv += [" - %s" % m for m in media]
|
|
108
|
+
inv.append("- embedded objects in word/embeddings: %d" % len(embeddings))
|
|
109
|
+
inv += [" - %s" % e for e in embeddings]
|
|
110
|
+
if embeddings:
|
|
111
|
+
inv.append("")
|
|
112
|
+
inv.append("Embedded objects are usually live PDFs behind a page icon. Recover and read")
|
|
113
|
+
inv.append("them before reporting the underlying report missing.")
|
|
114
|
+
with open(out, "w") as fh:
|
|
115
|
+
fh.write(header + text + "\n" + "\n".join(inv) + "\n")
|
|
116
|
+
|
|
117
|
+
print(out)
|
|
118
|
+
print("tables: %d | media: %d | embeddings: %d" % (tables, len(media), len(embeddings)))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
if __name__ == "__main__":
|
|
122
|
+
main()
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Combine images into a single PDF, one image per page, fit-to-page.
|
|
3
|
+
#
|
|
4
|
+
# images-to-pdf.sh -o out.pdf shot1.png shot2.png ...
|
|
5
|
+
# images-to-pdf.sh -o email.pdf --landscape email_01.png
|
|
6
|
+
#
|
|
7
|
+
# Why headless Chrome: it is already present on most operator machines, needs no
|
|
8
|
+
# Python packages, and renders exactly what a browser shows. ImageMagick and
|
|
9
|
+
# img2pdf are often absent, and Ghostscript-based paths fail silently on ICC
|
|
10
|
+
# profiles embedded by macOS screenshots.
|
|
11
|
+
#
|
|
12
|
+
# Orientation matters. A wide screenshot on an A4 portrait page sits small in the
|
|
13
|
+
# middle; pass --landscape when the images are wider than tall (email threads,
|
|
14
|
+
# dashboards, wide tables).
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
|
|
17
|
+
LANDSCAPE=0
|
|
18
|
+
OUT=""
|
|
19
|
+
IMAGES=()
|
|
20
|
+
|
|
21
|
+
while [[ $# -gt 0 ]]; do
|
|
22
|
+
case "$1" in
|
|
23
|
+
-o|--output) OUT="$2"; shift 2 ;;
|
|
24
|
+
-l|--landscape) LANDSCAPE=1; shift ;;
|
|
25
|
+
-h|--help) awk 'NR==1{next} /^set -e/{exit} {print}' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
26
|
+
*) IMAGES+=("$1"); shift ;;
|
|
27
|
+
esac
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
[[ -n "$OUT" ]] || { echo "error: -o <out.pdf> is required" >&2; exit 1; }
|
|
31
|
+
[[ ${#IMAGES[@]} -gt 0 ]] || { echo "error: no input images" >&2; exit 1; }
|
|
32
|
+
|
|
33
|
+
for f in "${IMAGES[@]}"; do
|
|
34
|
+
[[ -f "$f" ]] || { echo "error: missing image: $f" >&2; exit 1; }
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
# --- locate a Chromium-family browser -------------------------------------------
|
|
38
|
+
BROWSER=""
|
|
39
|
+
for c in \
|
|
40
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
|
|
41
|
+
"/Applications/Chromium.app/Contents/MacOS/Chromium" \
|
|
42
|
+
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" \
|
|
43
|
+
"$(command -v google-chrome || true)" \
|
|
44
|
+
"$(command -v chromium || true)" \
|
|
45
|
+
"$(command -v chromium-browser || true)"
|
|
46
|
+
do
|
|
47
|
+
[[ -n "$c" && -x "$c" ]] && { BROWSER="$c"; break; }
|
|
48
|
+
done
|
|
49
|
+
[[ -n "$BROWSER" ]] || { echo "error: no Chrome/Chromium found" >&2; exit 1; }
|
|
50
|
+
|
|
51
|
+
# --- page geometry --------------------------------------------------------------
|
|
52
|
+
# A4 at 96dpi. Chrome honours these as CSS pixels for @page sizing. The page box
|
|
53
|
+
# is one pixel short of the sheet: a box that exactly matches the printable area
|
|
54
|
+
# can tip Chrome into shrink-to-fit, which silently rescales every page.
|
|
55
|
+
if [[ $LANDSCAPE -eq 1 ]]; then
|
|
56
|
+
PAGE_W=1122; PAGE_H=793; CSS_SIZE="A4 landscape"
|
|
57
|
+
else
|
|
58
|
+
PAGE_W=793; PAGE_H=1122; CSS_SIZE="A4 portrait"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
WORKDIR="$(mktemp -d)"
|
|
62
|
+
trap 'rm -rf "$WORKDIR"' EXIT
|
|
63
|
+
|
|
64
|
+
# Images are referenced by absolute file:// URL so the HTML can live in the temp dir.
|
|
65
|
+
PAGES=""
|
|
66
|
+
for f in "${IMAGES[@]}"; do
|
|
67
|
+
abs="$(cd "$(dirname "$f")" && pwd)/$(basename "$f")"
|
|
68
|
+
PAGES+="<div class=\"page\"><img src=\"file://${abs}\"></div>"
|
|
69
|
+
done
|
|
70
|
+
|
|
71
|
+
cat > "$WORKDIR/pack.html" <<HTML
|
|
72
|
+
<!doctype html><html><head><meta charset="utf-8"><style>
|
|
73
|
+
@page { size: ${CSS_SIZE}; margin: 0; }
|
|
74
|
+
html, body { margin: 0; padding: 0; background: #fff; }
|
|
75
|
+
.page {
|
|
76
|
+
width: ${PAGE_W}px; height: ${PAGE_H}px;
|
|
77
|
+
display: flex; align-items: center; justify-content: center;
|
|
78
|
+
overflow: hidden; page-break-after: always; break-after: page;
|
|
79
|
+
}
|
|
80
|
+
.page:last-child { page-break-after: auto; break-after: auto; }
|
|
81
|
+
img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
|
|
82
|
+
</style></head><body>${PAGES}</body></html>
|
|
83
|
+
HTML
|
|
84
|
+
|
|
85
|
+
# Rendering is attempted twice. Chrome has shipped several headless modes, and
|
|
86
|
+
# plain `--headless` is deprecated in newer builds; a locked default profile (a
|
|
87
|
+
# browser already open on the operator's desktop) or a container without a
|
|
88
|
+
# user namespace then kills the run with an error that a silent redirect hides.
|
|
89
|
+
# Each attempt gets its own throwaway profile and its stderr kept, so a failure
|
|
90
|
+
# reports why instead of just "not produced".
|
|
91
|
+
rendered=0
|
|
92
|
+
for attempt in 1 2; do
|
|
93
|
+
flags=(--disable-gpu --disable-dev-shm-usage --user-data-dir="$WORKDIR/chrome$attempt" --no-pdf-header-footer)
|
|
94
|
+
if [[ $attempt -eq 1 ]]; then
|
|
95
|
+
flags+=(--headless=new)
|
|
96
|
+
else
|
|
97
|
+
# Last resort for containers and heavily restricted shells.
|
|
98
|
+
flags+=(--headless --no-sandbox)
|
|
99
|
+
fi
|
|
100
|
+
if "$BROWSER" "${flags[@]}" --print-to-pdf="$OUT" "file://$WORKDIR/pack.html" 2>"$WORKDIR/err$attempt"; then
|
|
101
|
+
[[ -s "$OUT" ]] && { rendered=1; break; }
|
|
102
|
+
fi
|
|
103
|
+
rm -f "$OUT"
|
|
104
|
+
done
|
|
105
|
+
|
|
106
|
+
if [[ $rendered -ne 1 ]]; then
|
|
107
|
+
echo "error: PDF rendering failed on attempt 1 and 2" >&2
|
|
108
|
+
tail -5 "$WORKDIR/err1" >&2 2>/dev/null || true
|
|
109
|
+
tail -5 "$WORKDIR/err2" >&2 2>/dev/null || true
|
|
110
|
+
exit 1
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
# Report the page count so the caller can verify nothing was dropped.
|
|
114
|
+
if command -v pdfinfo >/dev/null 2>&1; then
|
|
115
|
+
echo "$OUT: $(pdfinfo "$OUT" | awk '/^Pages:/{print $2}') pages, ${CSS_SIZE}"
|
|
116
|
+
else
|
|
117
|
+
echo "$OUT: written (${CSS_SIZE})"
|
|
118
|
+
fi
|
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
links, an entity chain, and a watchlist for the operator's next domains.
|
|
9
9
|
Not transaction data (tld-detection) or fraud rules (fraud-detection).
|
|
10
10
|
disable-model-invocation: true
|
|
11
|
-
release-version: 0.50.
|
|
11
|
+
release-version: 0.50.16
|
|
12
12
|
---
|
|
13
13
|
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
14
14
|
# Similar Domain
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
patterns, with USD and BIN-country currency views, group profiles and priorities.
|
|
7
7
|
Not payment-analysis, fraud-detection, or website research.
|
|
8
8
|
disable-model-invocation: true
|
|
9
|
-
release-version: 0.50.
|
|
9
|
+
release-version: 0.50.16
|
|
10
10
|
---
|
|
11
11
|
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
12
12
|
# TLD detection
|