Revision: 1 Last modified: 2026-12-04T17:48:16Z
The entry point of the workable-items Issues mirror (§11.4.300). It mirrors workable items from the project's SQLite database into the Issues of the declared tracker repositories — one direction only: the database is the source of truth, the trackers are a mirror.
Run it when: you want the tracker mirror planned, applied, verified or inspected. For the fuller composition (inbound
pull, Docs Chain orchestration, context bootstrap) use scripts/issues_sync_pipeline.sh
(docs/scripts/issues_sync_pipeline.md), which wraps this script.
Default OFF. With no config, or enabled: false, it prints disabled (default OFF): nothing to do and exits 0.
That is the shipped state.
bash,python3, PyYAML.- A config file:
--config F, default.workable-items-sync.yaml. A shipped template lives attemplates/workable-items-sync.yaml.template— copy it and setenabled: trueto turn the mechanism on. - A workable-items database:
--db F, defaultdocs/workable_items.db. --owner-repo HOST/OWNER/REPO— the repository that owns the items of this DB. Items route to its trackers only.--db-repo H/O/Rnames the DB's repository for prefixes that have no repository of their own (defaults to--owner-repo).- Tokens are read by variable NAME from the caller's environment (or a
0600 ~/api_keys.sh, parsed never sourced) and are never printed. - Permissions: read for
plan/verify/status/reconcile; write access to the trackers only forapply --apply.
# State, read-only. On the shipped default this prints "disabled (default OFF): nothing to do"
bash scripts/issue_sync.sh status
# What each tracker leg WOULD receive. No write.
bash scripts/issue_sync.sh plan --owner-repo github/Org/Repo
# Write. Requires --apply AND config mode: apply (+ apply_decision)
bash scripts/issue_sync.sh apply --apply --owner-repo github/Org/Repo \
--target github/Org/Repo --target gitlab/Org/Repo
# Read-only verification against the DB
bash scripts/issue_sync.sh verify --owner-repo github/Org/Repo
# Only open items (tier 1 skips items in a closed status)
bash scripts/issue_sync.sh plan --owner-repo github/Org/Repo --only-open --limit 50
# Machine-readable output
bash scripts/issue_sync.sh verify --owner-repo github/Org/Repo --json
# Never let 8-word shingles of a private corpus leave
bash scripts/issue_sync.sh plan --owner-repo github/Org/Repo \
--private-corpus docs/internal/notes.md
# An alternative config and DB
bash scripts/issue_sync.sh plan --config config/sync.yaml --db /var/lib/wi.db --owner-repo github/Org/RepoWhat you should see: plan lists the actions per leg; apply names what it wrote; verify prints a verdict and
exits 0/1/2; status prints the mechanism state (disabled (default OFF): nothing to do when off).
| Code | Meaning |
|---|---|
0 |
ok — every enabled leg matches the DB, or the mechanism is disabled (the default OFF state) |
1 |
drift (item ids and trackers are named) |
2 |
cannot determine — no token, host unreachable, capability unverified, visibility undetermined, redaction hard stop, quota. Never a pass. |
Subcommands accepted by the implementation (scripts/issue_sync/cli.py): plan, apply, verify, status,
reconcile, pull.
| Flag | Meaning |
|---|---|
--config F |
Config file (default .workable-items-sync.yaml) |
--db F |
Workable-items DB (default docs/workable_items.db) |
--owner-repo H/O/R |
Repository owning the items of this DB |
--db-repo H/O/R |
Repository whose DB this is (default: --owner-repo) |
--target H/O/R |
Tracker leg, repeatable |
--private-corpus FILE |
File whose 8-word shingles must never leave (repeatable; also ISSUE_SYNC_PRIVATE_CORPUS, path-separated) |
--apply |
Permit writes (still requires config mode) |
--only-open |
Skip items in a closed status |
--limit N |
Cap the number of items |
--json |
Machine-readable output |
--ack-lossy-capture |
apply: accept a conflict proposal that had to withhold a secret shape or truncate text, after reading the tracker text |
--write |
pull: write the proposal files (default: dry run, nothing written) |
--out-dir D |
pull/apply: proposals directory (default docs/issues_sync/inbound next to the config) |
- No config, or
enabled: false→disabled (default OFF): nothing to do, exit0. No token is consulted and nothing is read or written. applywithout--apply→ dry run. Both--applyand the config's mode (apply/apply_decision) are required before a single tracker write happens. A dry-run config cannot be forced to write by the flag alone.--ack-lossy-captureis an acknowledgement, not a bypass. It accepts a proposal that had to withhold a secret shape or truncate text — and the flag's own help says "after reading the tracker text", i.e. it is meant to be given only once you have looked.- A tracker edit of a synced issue (via
reconcile/pull) is a CONFLICT; the database wins and the edit is never applied inbound. - No token / unreachable host → exit
2, never0. The verifier's rule is that absence of evidence is not evidence of sync. - Redaction hard stop → exit
2. The mirror will not send content it cannot clear. --private-corpusblocks 8-word shingles of the named file from leaving, on both the DB payload and the tracker text.- Visibility undetermined (a repository whose public/private state cannot be read) → exit
2.
set -u.- Resolve
HEREand prepend it toPYTHONPATH(so theissue_syncpackage beside the script is importable without installation). exec python3 -W ignore -m issue_sync.cli "$@".- Inside the CLI: load the config (default OFF), resolve credentials by variable name, join the DB against the
owner-repo scope, compute the mirror payload (redacted, shingle-checked), then per leg
plan/apply/verifyas asked, and record the outcome in the DB's sync map.
The script itself is 13 lines and does none of this — it only sets PYTHONPATH and execs. All behaviour, flags and
exits come from the Python package.
scripts/issues_sync_pipeline.sh— the facade: addsrun,init-context, inboundpull --write, and the "refuses while a tracker edit is not yet preserved" guard.docs/scripts/issues_sync_pipeline.md.scripts/verify_issues_sync.sh— the read-only verifier; same exit semantics, plus--prove-failure.docs/scripts/verify_issues_sync.md.scripts/issue_sync/— the implementation package (cli,engine,inbound,adapters/,payload,redact,visibility,credentials,store,registry,mode,offline_status).templates/workable-items-sync.yaml.template— the config template (the default config filename is.workable-items-sync.yaml).- §11.4.300 (mandate), §11.4.296 (GitHub Issues as a source), §11.4.10 (credentials), §11.4.93/.95 (DB SSoT).
2026-12-04 — bash -n clean, and the shipped-default path executed for real (read-only, writes nothing):
$ bash -n scripts/issue_sync.sh && echo PARSE-OK
PARSE-OK
$ bash scripts/issue_sync.sh status; echo "RC=$?"
disabled (default OFF): nothing to do
RC=0The subcommand and flag lists were cross-checked against the implementation, not taken from the shim header:
$ grep -n 'choices=\["plan"' scripts/issue_sync/cli.py
74: ap.add_argument("cmd", choices=["plan", "apply", "verify", "status", "reconcile", "pull"])Documentation defect found (reported, not fixed — out of this pass's file scope): this shim's header usage line
advertises {plan|apply|verify|status}, but the CLI also accepts reconcile and pull, and four flags the header
never mentions (--private-corpus, --ack-lossy-capture, --json, --out-dir). The guide above documents the real
set.