@4pm/cli 1.5.16 → 1.5.17-c

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.
Files changed (52) hide show
  1. package/dist/index.js +19 -11
  2. package/dist/project-sample/.claude/.autonomous.approvals.json +1 -0
  3. package/dist/project-sample/.claude/.autonomous.settings.json +24 -0
  4. package/dist/project-sample/.claude/AUTONOMOUS-CRON.md +38 -0
  5. package/dist/project-sample/.claude/AUTONOMOUS.md +52 -0
  6. package/dist/project-sample/.claude/agents/.gitkeep +0 -0
  7. package/dist/project-sample/.claude/agents/long-memory/.gitkeep +0 -0
  8. package/dist/project-sample/.claude/agents/short-memory/.gitkeep +0 -0
  9. package/dist/project-sample/.claude/commands/auto-cycle.md +176 -0
  10. package/dist/project-sample/.claude/hooks/__pycache__/autonomous-history.cpython-312.pyc +0 -0
  11. package/dist/project-sample/.claude/hooks/autonomous-history.py +193 -0
  12. package/dist/project-sample/.claude/hooks/autonomous-tick.sh +356 -0
  13. package/dist/project-sample/.claude/rag/.gitkeep +0 -0
  14. package/dist/project-sample/.claude/settings.json +17 -0
  15. package/dist/project-sample/.claude/skills/check-usage/SKILL.md +40 -0
  16. package/dist/project-sample/.claude/skills/check-usage/check_usage.py +161 -0
  17. package/dist/project-sample/.claude/templates/AI_DONE.empty.md +9 -0
  18. package/dist/project-sample/.claude/templates/AI_DONE.sample.md +7 -0
  19. package/dist/project-sample/.claude/templates/AI_PLACEHOLDER.empty.md +11 -0
  20. package/dist/project-sample/.claude/templates/AI_PLACEHOLDER.sample.md +9 -0
  21. package/dist/project-sample/.claude/templates/AI_PROGRESS.empty.md +5 -0
  22. package/dist/project-sample/.claude/templates/AI_PROGRESS.sample.md +3 -0
  23. package/dist/project-sample/.claude/templates/AI_TODO.empty.md +14 -0
  24. package/dist/project-sample/.claude/templates/AI_TODO.sample.md +10 -0
  25. package/dist/project-sample/.claude/templates/README.md +14 -0
  26. package/dist/project-sample/.claude/templates/USER_QA.empty.md +6 -0
  27. package/dist/project-sample/.claude/templates/USER_QA.sample.md +7 -0
  28. package/dist/project-sample/.claude/templates/USER_TODO.empty.md +6 -0
  29. package/dist/project-sample/.claude/templates/USER_TODO.sample.md +6 -0
  30. package/dist/project-sample/.claude/templates/project.secrets.sample.json +5 -0
  31. package/dist/project-sample/.vscode/extensions.json +6 -0
  32. package/dist/project-sample/.vscode/settings.json +18 -0
  33. package/dist/project-sample/AI_DONE.md +9 -0
  34. package/dist/project-sample/AI_PLACEHOLDER.md +19 -0
  35. package/dist/project-sample/AI_PROGRESS.md +5 -0
  36. package/dist/project-sample/AI_SECURITY.md +30 -0
  37. package/dist/project-sample/AI_TODO.md +14 -0
  38. package/dist/project-sample/CLAUDE.md +0 -0
  39. package/dist/project-sample/USER_QA.md +6 -0
  40. package/dist/project-sample/USER_TODO.md +6 -0
  41. package/dist/project-sample/docs/.gitkeep +0 -0
  42. package/dist/project-sample/project.secrets.json.sample +5 -0
  43. package/dist/project-sample/project.settings.json +8 -0
  44. package/dist/project-sample/reports/.gitkeep +0 -0
  45. package/dist/project-sample/scripts/.gitkeep +0 -0
  46. package/dist/project-sample/src/.gitkeep +0 -0
  47. package/dist/project-sample/tests/IT/README.md +25 -0
  48. package/dist/project-sample/tests/IT/senarios/.gitkeep +0 -0
  49. package/dist/project-sample/tests/IT/tools/.gitkeep +0 -0
  50. package/dist/project-sample/tests/README.md +22 -0
  51. package/dist/project-sample/tests/UT/README.md +18 -0
  52. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ # Autonomous book templates
2
+
3
+ Canonical templates for the 5 "book" files used by the autonomous loop. Each book has two templates:
4
+
5
+ - `<NAME>.empty.md` — the EMPTY state. The tick's "has work" gate + `/auto-cycle` compare a live book
6
+ against this (equal ⇒ empty). When clearing/resetting a book, overwrite it with **exactly** this file
7
+ (`cp .claude/templates/<NAME>.empty.md <NAME>`).
8
+ - `<NAME>.sample.md` — an example WITH DATA, showing the expected format when adding entries.
9
+
10
+ Books: `USER_TODO`, `AI_TODO`, `AI_PROGRESS`, `AI_DONE`, `USER_QA` (+ `AI_PLACEHOLDER`). Keep the
11
+ header/blockquote when filling a book in; match the sample's format.
12
+
13
+ All templates are written in English by default; the project's own docs/source language is decided by the
14
+ project `CLAUDE.md`.
@@ -0,0 +1,6 @@
1
+ # USER_QA — Questions & answers
2
+
3
+ > When a request is unclear, the AI writes a question here instead of guessing. Answer it, then re-post
4
+ > the clarified request into `USER_TODO.md`.
5
+
6
+ _(no questions)_
@@ -0,0 +1,7 @@
1
+ # USER_QA — Questions & answers
2
+
3
+ ## 2026-01-01 — Login: which providers?
4
+ - Original request: "add a login screen".
5
+ - Unclear: email/password only, or also OAuth (Google/GitHub)?
6
+ - Options: (a) email+password only, (b) also Google, (c) also GitHub.
7
+ - Answer:
@@ -0,0 +1,6 @@
1
+ # USER_TODO — User requests
2
+
3
+ > Write what you want the AI to do (in the project's language — default English). The autonomous cycle
4
+ > reads this, generates tasks into `AI_TODO.md`, then clears this file back to the template.
5
+
6
+ _(no requests)_
@@ -0,0 +1,6 @@
1
+ # USER_TODO — User requests
2
+
3
+ > Write what you want the AI to do. The autonomous cycle reads this, generates tasks, then clears it.
4
+
5
+ - Add a login screen with email + password, validating inputs and showing errors.
6
+ - Wire it to the existing auth API and handle the error responses.
@@ -0,0 +1,5 @@
1
+ {
2
+ "ai_dev_branch": "main",
3
+ "api_base_url": "https://api.example.com",
4
+ "api_key": "sk-demo-0000…zzzz"
5
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "recommendations": [
3
+ "anthropic.claude-code",
4
+ "editorconfig.editorconfig"
5
+ ]
6
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "files.eol": "\n",
3
+ "files.insertFinalNewline": true,
4
+ "files.trimTrailingWhitespace": true,
5
+ "editor.formatOnSave": true,
6
+ "editor.tabSize": 2,
7
+ "editor.rulers": [
8
+ 100
9
+ ],
10
+ "[markdown]": {
11
+ "files.trimTrailingWhitespace": false
12
+ },
13
+ "search.exclude": {
14
+ "**/node_modules": true,
15
+ "**/dist": true,
16
+ "**/reports": true
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ # AI_DONE — Completed tasks + incidents
2
+
3
+ > The autonomous cycle appends completed tasks here (ID, description, timestamp) and logs incidents/notes.
4
+
5
+ ## Done
6
+ _(none)_
7
+
8
+ ## Incidents / notes
9
+ _(none)_
@@ -0,0 +1,19 @@
1
+ # AI_PLACEHOLDER — Placeholder table (key + explanation)
2
+
3
+ > Lists **placeholders** the AI understands: each has a **key** and an **explanation**. Reference them in
4
+ > docs/config as `${key}$` (e.g. `${ai_dev_branch}$`); the tool substitutes the real **value** at runtime.
5
+ >
6
+ > **Where values live:** the real value of each key is stored in `project.secrets.json` (same folder). This
7
+ > file holds only keys + explanations, so it is **safe to commit** and the AI can read it for context.
8
+ >
9
+ > **Why two files:**
10
+ > - `AI_PLACEHOLDER.md` (this file) — keys + explanations. Safe to commit; not gitignored/denied.
11
+ > - `project.secrets.json` — key → real value. **Gitignored** and **denied** in `.claude/settings.json`,
12
+ > so secret values never reach git and the AI can't read them directly. Manage values from the web
13
+ > (Placeholder tab) — they are write-only (never shown back).
14
+
15
+ | Key | Explanation |
16
+ |-----|-------------|
17
+ | ai_dev_branch | The shared dev branch the AI merges tasks into before the main branch. |
18
+ | api_base_url | Base URL of the internal API the AI calls during integration tests. |
19
+ | api_key | Key for the internal API (real value in project.secrets.json, NOT committed). |
@@ -0,0 +1,5 @@
1
+ # AI_PROGRESS — Task in progress
2
+
3
+ > The current in-progress task (set when the cycle starts a task, cleared when it finishes).
4
+
5
+ _(no task in progress)_
@@ -0,0 +1,30 @@
1
+ # AI_SECURITY — Security rules for the AI
2
+
3
+ This document describes the **security criteria** the AI (Claude Code) and users must follow when working
4
+ on the project. The AI reads this to know what data to protect, what to mask, and what must NEVER be
5
+ committed. Replace the sample rules below with your project's real policy.
6
+
7
+ ## 1. Security criteria
8
+ - Sensitive information must NOT leak into source code, logs, reports, or docs.
9
+ - Every secret must be loaded from environment variables / a secret manager, NEVER hard-coded.
10
+ - Grant only the least privilege needed for keys, tokens, and accounts.
11
+
12
+ ## 2. What to mask
13
+ When displaying, logging, or capturing evidence, mask the following (keep only a few leading/trailing chars):
14
+ - API keys, secret keys, access/refresh tokens, JWTs.
15
+ - Passwords, database connection strings, private keys.
16
+ - Personal data (PII): email, phone, national id, card numbers.
17
+ - `Authorization` headers, session cookies.
18
+
19
+ Example: `sk-ABCD…WXYZ` instead of the full key.
20
+
21
+ ## 3. Commit rules
22
+ - NEVER commit: `.env`, `*.key` / `*.pem`, credentials, `secrets.json`, API keys, passwords, or tokens.
23
+ - Check `git diff` before committing; if a secret slipped in, **rotate** that key.
24
+ - Keep `.gitignore` covering sensitive files/dirs (e.g. `.env`, `*.local.json`, `node_modules/`).
25
+ - Never put real customer data into tests/evidence — use fixtures.
26
+
27
+ ## 4. On a leak
28
+ 1. Rotate the leaked key/secret immediately.
29
+ 2. Remove the secret from git history if needed (e.g. `git filter-repo`).
30
+ 3. Record the incident and notify the project manager.
@@ -0,0 +1,14 @@
1
+ # AI_TODO — Task queue (generated by the AI)
2
+
3
+ > Tasks are generated from `USER_TODO.md`. ID format `TSK-{groupid:0000}-{taskid:0000}`
4
+ > (group = one request/batch, task = a small sub-task doable in ~1 cycle).
5
+ > **Priority** = High / Medium / Low.
6
+ > **Approved**: the source of truth is `.claude/.autonomous.approvals.json` (the user ticks it in the
7
+ > web VERIFY tab — ADR-0152); the Approved column here is display-only, not where the decision is made.
8
+ > **Depends** = the `TSK-…` ids that must be DONE (present in `AI_DONE.md`) first.
9
+ > `/auto-cycle` only takes tasks that are approved AND have their dependencies met → moves them to
10
+ > `AI_PROGRESS.md`; runs group by group, within a group High → Medium → Low.
11
+
12
+ | ID | Priority | Approved | Depends | Group | Task description | Notes |
13
+ |----|----------|----------|---------|-------|------------------|-------|
14
+ | | | | | | | |
File without changes
@@ -0,0 +1,6 @@
1
+ # USER_QA — Questions & answers
2
+
3
+ > When a request is unclear, the AI writes a question here instead of guessing. Answer it, then re-post
4
+ > the clarified request into `USER_TODO.md`.
5
+
6
+ _(no questions)_
@@ -0,0 +1,6 @@
1
+ # USER_TODO — User requests
2
+
3
+ > Write what you want the AI to do (in the project's language — default English). The autonomous cycle
4
+ > reads this, generates tasks into `AI_TODO.md`, then clears this file back to the template.
5
+
6
+ _(no requests)_
File without changes
@@ -0,0 +1,5 @@
1
+ {
2
+ "ai_dev_branch": "main",
3
+ "api_base_url": "https://api.example.com",
4
+ "api_key": "sk-demo-0000…zzzz"
5
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "folders": {
3
+ "docs": ".",
4
+ "tests": "tests",
5
+ "reports": "reports",
6
+ "src": "src"
7
+ }
8
+ }
File without changes
File without changes
File without changes
@@ -0,0 +1,25 @@
1
+ # Integration Test (IT)
2
+
3
+ Integration tests exercise **real end-to-end flows** and (optionally) capture **evidence** (before/after)
4
+ per test case, so a reviewer can see what changed.
5
+
6
+ ## Layout
7
+ | Folder | Role |
8
+ |--------|------|
9
+ | `senarios/<senario>/` | One folder per scenario: a spec per test case (`TC-00x-*.md`) + `testcases.json` (manifest of case ids/titles/params) + `senario.json` (name, description) |
10
+ | `tools/` | Your test runner / orchestrator + any helpers (choose the tooling that fits the project) |
11
+ | `evidence/` | Generated results per case: `<TC>/{before,after}` captures + logs + a summary |
12
+
13
+ ## Idea
14
+ For each relevant test case, capture the state **before** a change, make the change, capture **after**,
15
+ then gather the pair into a reviewable report. Capture only the cases relevant to the task.
16
+
17
+ ## Add a test case
18
+ 1. Pick/create a scenario `senarios/<senario>/`. Write `senarios/<senario>/TC-00x-*.md` (keep the
19
+ sections: Preconditions · Steps · Expected result · Evidence).
20
+ 2. Add an entry to `senarios/<senario>/testcases.json` (id, title, params your runner needs).
21
+ 3. Run your IT runner for that case to generate evidence.
22
+
23
+ > This sample ships the structure only — plug in the IT tooling appropriate for your stack (a browser
24
+ > harness like Playwright/Puppeteer for web UIs, an API test runner for services, etc.). Reference the
25
+ > run command from the project `CLAUDE.md`.
File without changes
File without changes
@@ -0,0 +1,22 @@
1
+ # Tests
2
+
3
+ Tests are organized in **two levels**:
4
+
5
+ - **Unit Test (UT)** — test each **unit** (function/module) in isolation; fast, no browser. Lives in
6
+ `tests/UT/`.
7
+ - **Integration Test (IT)** — test **real integration flows**, optionally capturing **evidence**
8
+ (before/after) per test case. Lives in `tests/IT/`.
9
+
10
+ ```
11
+ tests/
12
+ ├── UT/ # Unit Test — isolated unit tests
13
+ │ └── README.md # naming & conventions
14
+ └── IT/ # Integration Test — real-flow tests (+ evidence)
15
+ ├── senarios/<senario>/ # one folder per scenario: testcase specs (.md) + testcases.json + senario.json
16
+ ├── tools/ # your test runner / helpers
17
+ └── evidence/ # before/after + logs (generated)
18
+ ```
19
+
20
+ This sample ships the folder **structure** only — no test cases yet. Pick the test tooling that fits your
21
+ project (e.g. Node's `node:test`, Jest, Vitest, Pytest, Playwright…) and wire your own run command
22
+ (reference it from the project `CLAUDE.md`). See `tests/UT/README.md` and `tests/IT/README.md`.
@@ -0,0 +1,18 @@
1
+ # Unit Test (UT)
2
+
3
+ **Unit** tests: check each function/module in isolation — fast, deterministic, **no browser/render**.
4
+ Complements the Integration Tests in `tests/IT/`.
5
+
6
+ > This sample ships no UT cases — the folder is a skeleton. Add UT here following the conventions below.
7
+
8
+ ## Conventions
9
+ - One test file per module in `tests/UT/`, named to mirror the module under `src/` (e.g. `<module>.test.*`).
10
+ - Tests should run via your chosen runner (Node `node:test`, Jest, Vitest, Pytest, …) and **exit
11
+ non-zero on failure** so CI/the runner detects it.
12
+ - Keep UT **fast & isolated**: no network, no writes outside the test dir, no dependence on real time or
13
+ global state.
14
+
15
+ ## Add a test case
16
+ 1. Create `tests/UT/<module>.test.*`.
17
+ 2. Import the module under test from `src/`, assert each branch + edge case.
18
+ 3. Run your test command to confirm everything is green.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4pm/cli",
3
- "version": "1.5.16",
3
+ "version": "1.5.17c",
4
4
  "private": false,
5
5
  "description": "4PM CLI — drives Claude/Codex CLIs on AI worker machines (Node + TypeScript)",
6
6
  "license": "LicenseRef-4PM-Source-Available",