@rasensio/aidlc-content 1.2.0 → 1.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Rodrigo Asensio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rasensio/aidlc-content",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,10 +19,6 @@
19
19
  "capabilities/",
20
20
  "phases/"
21
21
  ],
22
- "scripts": {
23
- "build": "tsc",
24
- "test": "vitest run"
25
- },
26
22
  "engines": {
27
23
  "node": ">=18.0.0"
28
24
  },
@@ -35,5 +31,9 @@
35
31
  "fast-check": "^3.23.2",
36
32
  "typescript": "^5.8.3",
37
33
  "vitest": "^3.1.3"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "test": "vitest run"
38
38
  }
39
- }
39
+ }
@@ -41,10 +41,11 @@ All state lives in `.aidlc/state/<instance-name>/`. Read and write state as foll
41
41
  ### Writing State
42
42
 
43
43
  1. **Before mutating state**, check for an existing Instance_Claim in `instance.yaml`. If another session holds the claim and it is not stale, warn and request override confirmation.
44
- 2. Record your session identifier in the claim fields when you begin work.
44
+ 2. Claim with `aidlc claim <instance>` (release with `aidlc release <instance>`) — it updates `instance.yaml` and appends the claim event to `sessions.ndjson` in one step. Without the CLI, do both writes yourself: set the claim fields in `instance.yaml`, then append `{"event":"claim|release","session_id":"...","id_source":"agent","agent":"<platform>","timestamp":"<ISO 8601 UTC>"}` to `.aidlc/state/<instance>/sessions.ndjson`. Never rewrite that file — append only. If the CLI warns your claim is near timeout, run `aidlc claim --renew <instance>`.
45
45
  3. Update phase state files as you produce artifacts.
46
- 4. Append a transition record to `transitions.log` only on successful phase transitions.
46
+ 4. Append a transition record to `transitions.log` only on successful phase transitions. When completing a phase, set `metrics.elapsed_seconds` in its `phase-<name>.yaml` from `entered_at` → `completed_at` — cost and time reports read it.
47
47
  5. After a successful phase transition, fire lifecycle actions: `on-phase-exit` for the phase you left, then `on-phase-enter` for the phase you entered (see **Lifecycle Actions**).
48
+ 6. **Cost fallback (once per session):** run `aidlc cost providers status`. If no metered provider is ACTIVE for your platform, then at each phase transition record usage via `aidlc cost record --manual --instance <name> --session - --fidelity estimated --units '<json>'` when your platform surfaces usage numbers to you (e.g. a per-turn credit trailer), else `--fidelity unknown` (no `--units`). Never invent numbers — an `unknown` interval marker lets `aidlc cost sync` attribute usage later.
48
49
 
49
50
  ### Transition Records
50
51
 
@@ -22,17 +22,20 @@ One file per idea: `.aidlc/ideas/YYYYMMDD-<slug>.md`, beginning with exactly thi
22
22
  ---
23
23
  status: raw # raw | promoted | dropped
24
24
  promoted_to: null # instance name once promoted, else null
25
+ depends_on: [] # optional — ideas this one builds on, by file name without .md
25
26
  ---
26
27
  ```
27
28
 
28
29
  Ideas never silently vanish — they are `raw`, `promoted`, or explicitly `dropped` (the file stays in place). `status: promoted` always carries a non-null `promoted_to` naming an existing instance.
29
30
 
31
+ `depends_on` lists other backlog ideas whose outcome this one builds on (e.g. `20260815-traceability-ids`). It is optional and defaults to empty. Build order is derived from this graph when needed — there is no global `order` field to maintain, because concurrent capture from independent sessions cannot coordinate a sequence.
32
+
30
33
  ## Capture
31
34
 
32
35
  1. **Resolve the backlog root.** Always write to the **primary checkout's** `.aidlc/ideas/`, never a worktree's copy: resolve via `git rev-parse --git-common-dir` (the directory containing that path is the primary checkout). Outside a git repo, use the current project root. Create `.aidlc/ideas/` if missing.
33
36
  2. **Name the file.** `YYYYMMDD-<slug>.md` — today's date plus a short (2–4 word) slug derived from the idea.
34
37
  3. **Handle collisions.** If the filename already exists, ask one question — extend `<existing>` or new idea? On extend, append a dated `## Update (YYYY-MM-DD)` section; on new, suffix the slug (`-2`). Never silently overwrite.
35
- 4. **Write the file.** Frontmatter (`status: raw`, `promoted_to: null`), then `# Idea: <title>`, `**Date:**`, and the braindump organized lightly (a Use Case section plus whatever structure the content suggests). Do not interrogate the user for structure — capture friction kills inboxes; one braindump in, one file out.
38
+ 4. **Write the file.** Frontmatter (`status: raw`, `promoted_to: null`), then `# Idea: <title>`, `**Date:**`, and the braindump organized lightly (a Use Case section plus whatever structure the content suggests). If the braindump itself references other backlog ideas, record them in `depends_on`; never ask for dependencies — the field is optional. Do not interrogate the user for structure — capture friction kills inboxes; one braindump in, one file out.
36
39
  5. **Confirm and return.** Report the file path and return to whatever was happening.
37
40
 
38
41
  **Hard rule:** capture never reads or writes anything under `.aidlc/state/` — no claims, no phase files, no transitions log. Two sessions capturing simultaneously just produce two files; no locking exists or is needed. Do not auto-commit; staging is the user's.
@@ -41,16 +44,17 @@ If the user includes credentials, tokens, or secrets in a braindump, flag it and
41
44
 
42
45
  ## Browse
43
46
 
44
- List `.aidlc/ideas/*.md` reading only frontmatter and the `# Idea:` title line — not the bodies. Show each idea's date, title, and status. Offer to open, promote, or drop.
47
+ List `.aidlc/ideas/*.md` reading only frontmatter and the `# Idea:` title line — not the bodies. Show each idea's date, title, status, and dependencies (`depends_on`). Flag raw ideas whose dependencies are all promoted — those are the natural next candidates. Offer to open, promote, or drop.
45
48
 
46
49
  ## Promote
47
50
 
48
51
  Promotion is where the backlog meets the lifecycle:
49
52
 
50
- 1. Choose a template and scope as usual (defaults from `.aidlc/config.yaml`; see **aidlc-getting-started**).
51
- 2. Create the instance per "Creating an Instance" in **aidlc-overview** including firing `on-instance-start` lifecycle actions.
52
- 3. Seed the instance with the idea file: Full scope the idea is raw material the Ideation phase refines into `ideation.md`; Standard scope → the idea is input context for Requirements.
53
- 4. Update the idea's frontmatter: `status: promoted`, `promoted_to: <instance-name>`.
53
+ 1. If the idea's `depends_on` names ideas that are still `raw`, say so and confirm before proceeding promoting out of order is allowed but should be deliberate.
54
+ 2. Choose a template and scope as usual (defaults from `.aidlc/config.yaml`; see **aidlc-getting-started**).
55
+ 3. Create the instance per "Creating an Instance" in **aidlc-overview** including firing `on-instance-start` lifecycle actions.
56
+ 4. Seed the instance with the idea file: Full scope → the idea is raw material the Ideation phase refines into `ideation.md`; Standard scope → the idea is input context for Requirements.
57
+ 5. Update the idea's frontmatter: `status: promoted`, `promoted_to: <instance-name>`.
54
58
 
55
59
  ## Drop
56
60
 
@@ -21,7 +21,7 @@ Resume an in-progress lifecycle instance efficiently. Determine where work left
21
21
  - Check `renewed_at` against the staleness timeout (default: 60 minutes)
22
22
  - If stale: warn and request override confirmation before taking over
23
23
  - If active: warn and do NOT proceed without explicit override
24
- 3. **Claim the instance.** Record your session identifier and timestamp in the claim fields.
24
+ 3. **Claim the instance.** Prefer `aidlc claim <instance>` — it sets the claim fields and appends the claim event to `sessions.ndjson` (the durable session↔instance record cost attribution depends on). Without the CLI, do both: record your session identifier and timestamp in the claim fields, then append the claim event to `.aidlc/state/<instance>/sessions.ndjson` (append-only; see the state protocol in **aidlc-overview**). Release the same way when you stop (`aidlc release <instance>`).
25
25
  4. **Determine next step.** Apply this priority:
26
26
  - If current phase has incomplete required artifacts → produce the next artifact
27
27
  - If current phase is complete but not transitioned → evaluate transition (check gates)