Commit graph

122 commits

Author SHA1 Message Date
hermes
6628d3b2e9 fix(ownership): make publisher RESULT contract hold on every path
Addresses review on #29:
- drop errtrace: a failure inside $(...) printed two RESULT lines
- explicit failures go through fail(), which always prints
  RESULT: FAILED stage=...; idx check gets its own `preflight` stage;
  the never-failing published-manifest read is no longer a stage
- validate the built latest_as_of_date (`// empty` + date regex) so a
  corrupt manifest cannot compare as "newer"
- freshness: validate --now (exit 2) and latest_as_of_date (exit 3)
  before calling date
- flake: package an explicit script list instead of scripts/*.sh
- docs: GH_TOKEN prerequisite for the packaged publisher

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 21:50:51 +00:00
hermes
1f6f0ee02e feat(ownership): idempotent, packaged snapshot publisher
The self-hosted publish timer has not produced an upload since it was
enabled (manifest last updated 2026-07-14, a manual run), and failures
were invisible. Make the job safe to run daily and easy to deploy:

- publish-ownership-snapshot.sh: skip the upload when the published
  manifest already has the latest as-of date (pre-check via discover
  for XLSX sources, post-build check for legacy PDF); --force to
  override. Always ends with one line: RESULT: published|up-to-date
  <as-of> or RESULT: FAILED stage=<stage> (exit N). gh release create
  no longer requires a git checkout.
- check-ownership-snapshot-freshness.sh: exit 1 when the published
  latest_as_of_date is older than --max-age-days (default 40).
- flake: packages.ownership-publisher bundles the scripts with a
  pinned idx (curl-impersonate + mupdf) and jq/gh/sqlite/curl as
  bin/idx-ownership-publish and bin/idx-ownership-freshness, so hosts
  need no checkout, nix develop or cargo build at run time. Built in CI.
- contrib/systemd + docs: daily 06:00 UTC timer, run semantics table,
  freshness alarm, packaged usage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 21:40:02 +00:00
brutaljokerz
d4ec5015b9
Merge pull request #27 from 0xrsydn/feat/ownership-xlsx-snapshot
feat(ownership): build snapshots from XLSX with monthly history [3/3]
2026-09-25 04:22:34 +07:00
hermes
c866dd7a65 fix(ownership): harden --history parsing per review
Addresses review on #27: canonicalize --history ("08" no longer hits
bash octal parsing), run the history jq in a plain command
substitution so a jq failure aborts under set -e, and restore the
schedule-guidance paragraph in OWNERSHIP_SELF_HOSTED.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 21:12:34 +00:00
hermes
c2d2734739 feat(ownership): build snapshots from XLSX with monthly history
- build-latest-ownership-snapshot.sh: discover with a wider limit and
  add --history <n> to import the n previous supported above-1% XLSX
  months (one per as-of date, oldest first) before the latest, so
  `idx ownership changes` works straight from a synced snapshot.
- publish-ownership-snapshot.sh: pass --history through (for the
  clan-private systemd timer via extraArgs).
- publish-ownership-snapshot.yml: `history` input (default 5).
- Docs: publish/self-hosted flow now describes the XLSX source,
  observed upload days (2nd-3rd of the month), and --history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 21:12:05 +00:00
hermes
bb39e98fab fix(ownership): harden data-page discovery per review
Addresses review on #26:
- strip ?query/#fragment before the .xlsx/.pdf extension check
- skip page entries without a parseable as-of date instead of emitting
  an empty publish_date
- warn on stderr when the data page fails or parses to zero entries
  while announcement results still exist, instead of silently
  degrading to announcement-only results

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 21:11:56 +00:00
hermes
29e416109c feat(ownership): discover above-1% XLSX on the IDX data page
IDX stopped posting the monthly above-1% list as an announcement after
the 2026-05-29 report; June/July/August are only on the Data
Kepemilikan Saham page. `ownership discover` could not see them, and
IDX's Cloudflare now rejects curl_chrome142 on that page and on the
/Media/ XLSX files.

- remote: parse the page's Nuxt payload (Description/Prospectus pairs,
  / escapes), classify above-1% XLSX as supported and above-5% /
  investor-type workbooks as unsupported, derive as_of_date from the
  Indonesian description. Keep all above-1% entries, only the newest
  of the other series. Merge with the announcement results.
- discover JSON gains `format` (xlsx|pdf) and `as_of_date`; page
  entries use the as-of date as publish_date (the page shows none).
- import --url accepts .xlsx and downloads via the XLSX validator.
- curl_impersonate: run_owned_with_fallback tries several browser
  profiles until the body validates (JSON / page payload / %PDF / PK);
  IDX_CURL_IMPERSONATE_BIN still pins one.
- Tests: page fixture parsing, date parsing, payload validation, CLI
  discover via a local page server; existing discover tests now point
  IDX_OWNERSHIP_DATA_PAGE_URL at a closed port so no test hits IDX.
- Docs: ARCHITECTURE discovery section, AGENTS ownership inputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 21:09:05 +00:00
hermes
06d0a7a2ae fix(ownership): pin XLSX excerpt row count, report Excel row numbers
Addresses review on #25: sheet XML omits blank rows, so error messages
now use each <row r=...> number instead of the position; the excerpt
test pins the exact row count so dropped rows fail loudly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 21:08:57 +00:00
hermes
c1950972ff fix(ownership): accept Feb/Mar 2026 INVESTOR_TYPE header in XLSX
The February and March 2026 above-1% workbooks name the investor
column INVESTOR_TYPE (codes such as CP, ID); April onward uses
INVESTOR_CLASSIFICATION (words). Treat both as the same field; every
other column stays strict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 20:59:34 +00:00
hermes
2c85acb829 feat(ownership): import IDX above-1% XLSX holder register
Since June 2026 IDX publishes the monthly "Pemegang Saham di Atas 1%"
list as an XLSX workbook on the Data Kepemilikan Saham page instead of
a PDF announcement. Add a parser for it and accept `.xlsx` in
`ownership import --file`.

- src/ownership/xlsx.rs: zip + quick-xml reader (shared strings incl.
  rich text, sheet cells), exact 12-column header match so the daily
  above-5% and investor-type/classification workbooks are rejected,
  Excel serial dates, numeric shares, percent -> bps with float-noise
  rounding. Builds KseiHoldingDraft directly and reuses the entity
  normalizers, so investor types stay uppercase like the PDF path.
- Fixtures: trimmed excerpts of the real 2026-08-31 above-1% and
  2026-09-23 above-5% workbooks.
- Unit + CLI tests: import, ticker, releases, above-5% rejection.
- Docs: ARCHITECTURE parser pipeline, AGENTS ownership inputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 20:48:07 +00:00
brutaljokerz
5bf3e5d5e3
Merge pull request #24 from 0xrsydn/feat/curl-install
feat: add curl | sh install script
2026-09-25 02:46:35 +07:00
hermes
aabb00d3b7 fix: expand quoted ~ in install dir and trim trailing slashes on mirror URLs
Addresses Pullfrog review on #24; adds a fixture test for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 19:34:18 +00:00
hermes
a142a3718f feat: add curl | sh install script
- install.sh: POSIX sh installer that detects OS/arch (incl. Rosetta),
  resolves the newest vX.Y.Z release via the GitHub API (skipping
  ownership-snapshot-current), verifies SHA256SUMS, sanity-runs the
  binary, and installs atomically into ~/.local/bin without sudo.
  Supports --version/--dir and IDX_* env overrides; prints a PATH
  hint, a NixOS flake suggestion, and helper-tool install hints
  instead of calling package managers.
- scripts/install-sh-test.sh: fixture tests against a local fake
  release server (latest, pinned, piped, checksum mismatch, missing
  release, unsupported OS, PATH hint, reinstall).
- ci.yml: install-script job (ShellCheck, sh + dash on Linux, sh on
  macOS).
- release.yml: attach install.sh to each release.
- README + docs/INSTALL.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 19:29:52 +00:00
brutaljokerz
52cf73beb9
Merge pull request #22 from 0xrsydn/feat/npm-distribution
feat: add npm distribution wrapper for idx-cli
2026-09-25 02:18:04 +07:00
hermes
4f8c90a108 fix: harden npm distribution release and installer
- release.yml: build static musl Linux binaries (no host glibc
  requirement), add darwin-x64, publish SHA256SUMS, allow
  workflow_dispatch for an existing tag (v0.2.3 has no binaries yet),
  and run build-only on PRs that touch the workflow or installer
- install.js: verify downloads against the release SHA256SUMS
  (IDX_BINARY_SHA256 for overrides), add a 60s request timeout, use
  stream.pipeline so truncated downloads fail, and skip the download
  inside the source checkout
- idx.js: forward SIGTERM/SIGHUP to the binary and keep the signal
  exit status
- package.json: drop the prepare script (no Rust toolchain needed to
  pack/publish)
- npm-smoke.sh: read the tarball name from npm pack, use grep over rg
- .gitignore: ignore /bin/ and *.tgz
- docs: musl targets, checksums, pnpm/bun opt-in, manual release flow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
2026-09-24 18:57:53 +00:00
Amp
44b9c16d82
chore: warm orb local data during setup
`.agents/setup` now pre-loads the CLI's local data after the build: it
installs the published ownership snapshot (`idx ownership sync`, the
repo's preferred bootstrap path) and warms the file cache for the shipped
`stocks` read commands, so a fresh orb can query ownership data and serve
`--offline` reads immediately.

Setup also adopts the dev shell environment for its remaining steps via
`nix print-dev-env` (the same mechanism the login-shell hook uses), and
the orb guidance block is replaced in place so text updates reach orbs
that already have one without accumulating blank lines.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0ba76-221d-728b-9d68-45ab48750d3d
Co-authored-by: The Diligence Dev <thediligencedev@gmail.com>
2026-09-20 14:30:52 +00:00
Amp
cbf5694441
chore: add orb setup and resume hooks
Fresh Amp orbs start without a Rust toolchain or Nix, so every agent would
repeat the same install. `.agents/setup` installs Nix (single-user),
realizes the flake dev shell, activates it for the login shells Amp and orb
services start, and warms target/ so the first agent command is incremental.
`.agents/resume` re-checks the toolchain after a pause.

Also ignore .amp/portals/ so orb runtime files stay out of git status.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0ba76-221d-728b-9d68-45ab48750d3d
Co-authored-by: The Diligence Dev <thediligencedev@gmail.com>
2026-09-19 16:34:34 +00:00
brutaljokerz
d7222d54b5
Merge pull request #23 from 0xrsydn/pullfrog/add-workflow-1787052619899
chore: add Pullfrog workflow file
2026-08-18 18:34:07 +07:00
pullfrog[bot]
82acd35059
chore: add Pullfrog workflow file 2026-08-18 11:30:20 +00:00
hermes
221dc01397 feat: add npm distribution wrapper for idx-cli
Add an npm wrapper (package.json + postinstall downloader) so the Rust
binary can be installed via npm/npx. Include a local smoke test, a GitHub
Release cross-compile workflow, and nodejs in the dev shell.

- package.json: idx-cli v0.2.3, bin idx, engines node>=16
- scripts/install.js: dependency-free postinstall that downloads the
  platform-specific GitHub Release asset (or IDX_BINARY_URL override)
- scripts/idx.js: binary launcher preserving exit codes/signals
- scripts/npm-smoke.sh: npm pack -> install tarball -> run idx --help
  and idx config --help, locale, no publish required
- .github/workflows/release.yml: cross-compile linux-x64/arm64 and
  darwin-arm64 releases and attach binaries to the version tag
- flake.nix: add nodejs_22 to the dev shell
- docs/NPM_DISTRIBUTION.md: usage, local test, and release flow
2026-08-18 11:14:55 +00:00
brutaljokerz
603c0e49c1
Merge pull request #21 from 0xrsydn/fix/ksei-spaced-headers v0.2.3
fix: handle spaced KSEI PDF headers + bump to v0.2.3
2026-08-01 02:24:36 +07:00
hermes
09f7fe420c fix: satisfy clippy 1.97 lints failing on CI
- sanitize_current_ratio: and_then if/else -> filter
- screener/graph sorts: sort_by with reversed cmp -> sort_by_key(Reverse)
- insert_ksei_holdings_rows: manual Result match -> ?

Fixes the Clippy step on ubuntu-latest (rust 1.97) that the nix
toolchain (1.93.1) did not flag.
2026-07-31 12:14:58 +00:00
hermes
a5cfdd79b4 fix: handle spaced KSEI PDF headers (SHARE CODE vs SHARE_CODE)
Newer KSEI above1 PDFs use spaces in column headers (SHARE CODE,
INVESTOR NAME, INVESTOR CLASSIFICATION) instead of the underscored
form (SHARE_CODE, INVESTOR_NAME, INVESTOR_TYPE) that the parser
schema markers expected.  This caused valid holder-register PDFs to
be misclassified as LegacyAboveFivePercent (false positive on
REKENING TAMPUNGAN KSEI text in the data), blocking import.

Changes:
- Add normalize_stext_for_classification() that replaces spaces with
  underscores inside text="..." attributes before schema marker
  matching, so both old and new header layouts are recognized
- Add INVESTOR_CLASSIFICATION to HOLDER_REGISTER_SCHEMA_MARKERS and
  HEADER_LABELS to match the renamed column
- Update ANNOUNCEMENT_WRAPPER and ABOVE_FIVE marker constants to use
  underscores (matching the normalized text)
- Add test fixture and test case for the spaced-header layout
- Bump version to 0.2.3

Tested against the live June 2026 KSEI PDF (as_of 2026-05-29):
  idx ownership import --url <latest-pdf-url>
  -> Imported 7124 rows for 956 tickers (as of 2026-05-29)
2026-07-29 04:21:54 +00:00
a2d15d2125 feat: support explicit MSN chart history 2026-04-15 13:48:27 +07:00
Rasyidan A F
b480828f39
Merge pull request #20 from 0xrsydn/fix-msn-nonfinite-keyratios
fix: handle non-finite MSN key ratios
2026-04-14 14:14:14 +07:00
19748d397e fix: handle non-finite msn key ratios 2026-04-13 23:34:36 +07:00
Rasyidan A F
e2c0425a3b
Merge pull request #19 from 0xrsydn/codex/self-hosted-ownership-publish
Draft self-hosted ownership snapshot publish flow
2026-04-13 18:27:43 +07:00
411336e301 fix: refresh snapshot publish output dir 2026-04-13 18:21:36 +07:00
c67748d950 ops: draft self-hosted ownership snapshot publish flow 2026-04-13 16:46:53 +07:00
f24aa888b5 docs: add idx release skill 2026-04-13 14:39:40 +07:00
5f1d9e6d24 fix: resolve clippy manual_flatten warning in snapshot
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 14:41:01 +07:00
aad29eaf23 feat: default ownership sync to published snapshot 2026-04-12 14:27:47 +07:00
Rasyidan A F
71f283edc3
Merge pull request #18 from 0xrsydn/codex/ownership-snapshot-publish ownership-snapshot-current
[codex] add ownership snapshot publish flow
2026-04-12 13:47:48 +07:00
afa20d9b2f feat: add ownership snapshot publish flow 2026-04-12 13:35:09 +07:00
04eaa75882 fix: handle missing scrip column in April 2026 KSEI PDF v0.2.2
The April 2026 IDX ownership PDF omits the zero-valued scrip column for
some holders, causing the parser to leave holdings_scripless/scrip as
empty strings. This broke normalize_ksei_row which called parse_id_number
on empty input.

Two-layer fix:
- Parser: pop_numeric_tail handles 2-column (missing scrip) rows by
  defaulting scrip to "0"
- Normalizer: parse_id_number_or_zero backstop treats empty component
  share fields as 0 while still requiring total_shares

Also includes AGENTS.md refresh, formatting cleanup (rustfmt), and
version bump to 0.2.2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:15:19 +07:00
c94c826307 chore: prepare v0.2.1 release v0.2.1 2026-04-06 17:47:20 +07:00
1f5c4b2798 Add KSEI archive fallback import 2026-03-31 19:29:00 +07:00
8404b27628 Add ownership snapshot sync 2026-03-31 19:28:13 +07:00
1e5be755ea Merge branch 'codex/batch-2' 2026-03-31 07:41:28 +07:00
a52712b063 Complete batch 2 ownership import hardening 2026-03-30 16:40:32 +07:00
b1a8c88024 docs: record post-merge batch 1 reconfirmation 2026-03-30 14:59:56 +07:00
c0bcf9c688 test: add real above1 parser fixture
Add a compact parser fixture excerpted from the real 2026-03-10 IDX above1 lamp1 mutool stext output and assert the first live row still parses as expected.

This keeps the post-merge ownership parser coverage grounded in the supported above1 layout instead of relying only on synthetic line fixtures.
2026-03-30 13:06:39 +07:00
5f75856b16 Merge pull request #17 from 0xrsydn/codex/test-first-batch-live-e2e
Ownership Refactor
2026-03-30 12:59:48 +07:00
7928e83cc5 test: reset smoke cache between warm cases
Clear the smoke cache before each cache-group warm case so the following offline and stale-cache checks always start from a fresh baseline instead of earlier group state.

Document the runner behavior in the smoke guide to make the cache-group sequencing explicit.
2026-03-30 12:35:22 +07:00
9d406ba3ee Add IDX above1 ownership discovery and import 2026-03-30 11:58:53 +07:00
a36648fd89 ownership: add IDX above1 discovery and import
Refactor KSEI PDF parsing for the live above-1 holder-register layout, add IDX announcement discovery plus browser-impersonated PDF fetches, and update the ownership docs to mark Batch 1 complete and scope Batch 2 around above1 hardening and unsupported legacy inputs.
2026-03-30 11:57:14 +07:00
b431a8c251 docs: smoke testing 2026-03-27 16:54:05 +07:00
d23f16e7a3 test: live smoke testing 2026-03-27 16:53:57 +07:00
5d80891d40 chore: type, schema, error define 2026-03-27 16:53:50 +07:00
76656de1f6 feat: cache, schema 2026-03-27 16:53:09 +07:00