silvermoon 0.0.2 → 0.1.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/docs/reference.md CHANGED
@@ -44,8 +44,9 @@ Each world is an opaque Git tree:
44
44
  - `deploymentRevision` identifies `outer/` and includes both nested worlds.
45
45
 
46
46
  `status.yaml` and `ledger.md` are outside all three world trees. The repository
47
- object format in use determines revision shape; Silvermoon validates object
48
- types and candidate bindings rather than interpreting world contents.
47
+ object format in use determines revision shape. Silvermoon validates canonical
48
+ revision shape, computes the current world trees, and compares those values to
49
+ status facts rather than interpreting world contents.
49
50
 
50
51
  ## Status File
51
52
 
@@ -67,9 +68,12 @@ world revision and does not change lifecycle decisions. Explicit
67
68
  keys, YAML aliases or anchors, comments, and noncanonical YAML are rejected.
68
69
 
69
70
  Effective language resolves as `idea language > project preferredLanguage >
70
- user preferredLanguage > en-US`. JSON reports expose
71
- `language: { tag, source }`; human output shows the same values. Missing idea
72
- language remains dynamically inherited and is never written back.
71
+ user preferredLanguage > en-US`. Every complete observation exposes the
72
+ resolved non-empty tag as `configuration.preferredLanguage`. Missing idea
73
+ language remains dynamically inherited and is never written back. Dialogue
74
+ project status presents this effective value as `interaction language`
75
+ (`交互语言`), meaning the language Silvermoon should use to interact with the
76
+ user rather than a programming language used by the project.
73
77
 
74
78
  State is derived in order:
75
79
 
@@ -84,51 +88,207 @@ State is derived in order:
84
88
  ## Public Commands
85
89
 
86
90
  ```sh
87
- silvermoon whats-next [idea]
88
- silvermoon create-idea [--language <tag>]
89
- silvermoon check [--remote | --commit <revision> | --staged | --worktree]
91
+ silvermoon whats-next [idea] [--trace <file.trace.jsonl>]
92
+ silvermoon create-idea [--language <tag>] [--trace <file.trace.jsonl>]
93
+ silvermoon check [--remote | --commit <revision> | --staged | --worktree] [--trace <file.trace.jsonl>]
90
94
  ```
91
95
 
92
- `whats-next` returns one highest-priority action after repository and onboarding
93
- diagnosis. JSON reports include `observedPrimaryCommit`, `language`,
94
- `selectedIdea`, and exactly one `action`. When onboarding passes without gaps,
95
- the report omits `onboarding`. Otherwise `onboarding.gaps` contains only unmet,
96
- conflicting, or unknown requirements, preserving their stable IDs, statuses,
97
- blocking flags, dependencies, observed facts, and structured remediation. The
98
- compact onboarding report also includes a recommended action and recheck
99
- command. Human-readable output follows the same quiet-success, actionable-gap
100
- semantics. Use `check` when a complete repository diagnostic is required.
101
-
102
- Execution source is classified as `source-checkout`, `project-local`,
103
- `temporary`, `global`, or `unknown`. Temporary execution can bootstrap
104
- diagnosis; normal idea work requires the exact project dependency, installed
105
- package, and matching repository-local skill.
106
-
107
- `create-idea` applies the same hygiene preflight and then creates one canonical
108
- scaffold. Its optional language override is normalized before preflight and is
109
- the only command override; without it the status remains dynamically
110
- inherited. It does not stage, commit, push, or record approval.
96
+ `whats-next` and `create-idea` build one dialogue envelope:
97
+
98
+ ```json
99
+ {
100
+ "intention": {
101
+ "command": "whats-next",
102
+ "args": {
103
+ "idea": null
104
+ }
105
+ },
106
+ "observation": {},
107
+ "outcomes": [],
108
+ "instructions": ""
109
+ }
110
+ ```
111
+
112
+ - `intention` contains the command and normalized business arguments. Output
113
+ format is not part of the intention.
114
+ - `observation` describes the reliable facts for the requested command and
115
+ intent, not a mandatory global idea inventory.
116
+ - `outcomes` records only high-level repository side effects actually
117
+ attempted by this invocation. Each item has `type`, `status` (`success` or
118
+ `failure`), and `summary`. An empty array means no side effect was attempted.
119
+ - `instructions` contains all ordered next-step guidance for the current
120
+ readiness layer. A single remediation is plain text; multiple remediations
121
+ are numbered in priority order.
122
+
123
+ Default dialogue output renders the same report with concise lists under
124
+ `## Current instruction`, `## Project status`, and `## Suggested next steps`
125
+ (in Chinese: `## 本次指示`, `## 项目现状`, `## 下一步建议`). The optional
126
+ `## Actions and results` (`## 本次操作及结果`) appears only when a visible
127
+ outcome remains. A successful fetch is omitted from text when local HEAD
128
+ matches the fetched primary; failed fetches and synchronization problems remain
129
+ visible. JSON always records attempted outcomes, even when text omits routine
130
+ success. `--json` serializes the same decision; there is no YAML output or
131
+ second reasoning path. Within the project-status section, nonempty navigation
132
+ candidates and observed problems appear under `### Ideas you can continue` and
133
+ `### Issues to address` (in Chinese: `### 可继续推进的想法` and
134
+ `### 需要处理的问题`). Suggested next steps refer to these candidates without
135
+ repeating their inventory. Empty sections are omitted. Dialogue exit status
136
+ `0` means a trustworthy report was formed, even when it reports readiness
137
+ blocks or a failed operation; `1` means an internal failure prevented a
138
+ trustworthy report; `2` means invalid CLI usage.
139
+
140
+ All commands accept `--trace <file.trace.jsonl>`. If the supplied path does not
141
+ end with the exact lowercase `.trace.jsonl` suffix, Silvermoon appends it while
142
+ preserving the directory and original name. Repository-local `*.trace.jsonl`
143
+ files are ignored by the canonical repository. The trace is newline-delimited
144
+ JSON with paired `span-start` and `span-end` events, UTC timestamps, monotonic
145
+ `durationMs`, parent span IDs, and success or error status. It covers the
146
+ command, snapshot observation, adoption, user configuration, idea layout,
147
+ repository readiness, temporary snapshot materialization, and individual Git
148
+ commands. Git events record the subcommand and result but not command arguments,
149
+ stdout, or stderr. The path is relative to the caller's working directory when
150
+ not absolute. Events are buffered so a trace inside the repository cannot
151
+ affect that invocation's worktree observation. The file is written after the
152
+ measured command work finishes and uses exclusive creation, so an existing
153
+ normalized target is never overwritten.
154
+
155
+ Observations are discriminated by command intent and `state`:
156
+
157
+ - `project-setup-required` uses `observedThrough` (`root`, `version`,
158
+ `configuration`, or `ideas`) to identify the deepest reliable cumulative
159
+ shape. Fields beyond that boundary are absent rather than null or fabricated.
160
+ - `repository-sync-required` is used by `whats-next` and always includes
161
+ `root`, `version`, `configuration`, `ideas`, and at least one `problem`.
162
+ - `repository-preparation-required` is used by `create-idea` when its local
163
+ safety checks fail. It includes `root`, `version`, `configuration`, and at
164
+ least one `problem`, but no idea inventory or remote synchronization facts.
165
+ - Bare `whats-next` returns `navigation-ready` with `ideas.counts` and
166
+ `ideas.activeIdeas` (possibly empty). It never selects a candidate.
167
+ - Selected `whats-next` returns `idea-selected` with only `selectedIdea`
168
+ (`id`, optional `alias`, lifecycle `state`), including terminal ideas.
169
+ Unknown selectors return `idea-not-found` with `candidates`, not a
170
+ fabricated selected idea.
171
+ - After a successful `create-idea` preflight, `idea-created` carries
172
+ `createdIdea` (`id`, `path`, `state: "preparing"`). This confirms
173
+ pre-creation readiness, not a clean post-creation worktree. An attempted but
174
+ failed scaffold returns `idea-create-failed` without `createdIdea`; preflight
175
+ failures retain their setup or local preparation state.
176
+
177
+ Dialogue versions have `version.type: "worktree"`. When present, `ideas.counts` has
178
+ `preparing`, `implementing`, `deploying`, `completed`, and `abandoned`;
179
+ `activeIdeas` contains only minimal references for the first three states.
180
+ Problems have only stable `type` and natural-language `summary`; remediation
181
+ belongs in dialogue `instructions`.
182
+
183
+ Project setup is ecosystem-neutral. It checks Git, configuration schema
184
+ compatibility, and exact canonical skill content at
185
+ `.agents/skills/silvermoon`. It does not inspect execution source or require a
186
+ package manager, `package.json`, project-local Silvermoon dependency, or
187
+ `node_modules`.
188
+
189
+ `whats-next` checks local conflicts and changes before remote access, then HEAD
190
+ and upstream identity, then fetch and ancestry. A local branch may have any
191
+ name, but its upstream must identify the configured repository and primary
192
+ branch. Change summaries have fixed item and UTF-8 byte budgets and provide
193
+ full counts and omitted counts; instructions require inspection of the complete
194
+ change set without prescribing a particular diff tool. Bare navigation
195
+ never selects an idea: it always lists every active idea alongside the option
196
+ to discuss and run `create-idea`.
197
+
198
+ `create-idea` requires the configured primary branch and upstream plus a clean
199
+ worktree, then creates one canonical scaffold. It does not fetch, compare
200
+ remote ancestry, or require local HEAD to match the remote tip. Its optional
201
+ language override is normalized before preflight and is the only command
202
+ override; without it the status remains dynamically inherited. It does not
203
+ stage, commit, push, or record approval.
111
204
 
112
205
  ## Validation Targets
113
206
 
114
- - `check` validates only the committed `HEAD` snapshot and reads primary
115
- coordinates from that snapshot.
207
+ - `check` validates only the committed `HEAD` snapshot. It is not a
208
+ pre-commit check.
116
209
  - `check --worktree` validates the hypothetical commit formed from `HEAD`, the
117
210
  index, unstaged changes, and nonignored untracked files.
118
- - `check --staged` validates the index snapshot.
211
+ - `check --staged` validates the index snapshot for a pre-commit hook.
119
212
  - `check --commit <revision>` validates one local commit snapshot.
120
213
  - `check --remote` fetches primary using committed coordinates, validates its
121
- immutable tip, and proves retained revision facts against complete reachable
122
- primary history.
214
+ immutable tip, and does not audit the history or provenance of retained
215
+ revision facts. Unrelated skill or idea findings in local `HEAD` do not block
216
+ locating and validating the remote snapshot.
123
217
 
124
218
  Targets are mutually exclusive and never change the caller's branch, index, or
125
- worktree. Exit status `0` means success, `1` means validation or operational
126
- failure, and `2` means invalid CLI usage. `--json` emits the stable report
127
- envelope.
219
+ worktree. `--remote` may fetch Git objects, but it does not produce dialogue
220
+ outcomes. `check` validates the selected snapshot's project contract only:
221
+ Git, configuration, canonical skill, idea layout, world revisions, and status.
222
+ Its result depends on the materialized tree, not commit parents, parent order,
223
+ branch, merge/cherry-pick path, or retained decision reachability. A canonical
224
+ decision revision that differs from the current world is a valid historical
225
+ fact and naturally derives an earlier lifecycle state; it need not still exist
226
+ in the local object database. `check` does not check local worktree cleanliness,
227
+ upstream, or ancestry readiness, route ideas, or give next-step instructions.
228
+
229
+ Unlike dialogue commands, `check --json` contains **only** `intention` and
230
+ `observation`:
231
+
232
+ ```json
233
+ {
234
+ "intention": {
235
+ "command": "check",
236
+ "args": { "target": { "type": "staged" } }
237
+ },
238
+ "observation": {
239
+ "state": "project-ready",
240
+ "root": "D:\\Code\\silvermoon",
241
+ "version": { "type": "staged" },
242
+ "configuration": {
243
+ "primaryRepository": "https://example.com/owner/repository.git",
244
+ "primaryBranch": "main",
245
+ "preferredLanguage": "en-US"
246
+ },
247
+ "ideas": {
248
+ "counts": {
249
+ "preparing": 0,
250
+ "implementing": 0,
251
+ "deploying": 0,
252
+ "completed": 0,
253
+ "abandoned": 0
254
+ },
255
+ "activeIdeas": []
256
+ },
257
+ "problems": []
258
+ }
259
+ }
260
+ ```
261
+
262
+ `intention.args.target.type` is `head`, `staged`, `worktree`, `commit`, or
263
+ `remote`; a requested `--commit` revision stays in intention. A resolved
264
+ `HEAD` or local commit is reported in observation as
265
+ `version: { type: "commit", commit: "<oid>" }`; a fetched remote tip is
266
+ `{ type: "remote", commit: "<oid>" }`. Failed commit resolution or fetch
267
+ reports `commit: null` and a problem. Staged and worktree versions only
268
+ contain `type`.
269
+
270
+ The `check` observation has its own discriminated states:
271
+
272
+ - `project-ready` has root, version, resolved configuration, idea summary,
273
+ and empty problems. It says nothing about repository synchronization.
274
+ - `project-setup-required` has nonempty problems and the same progressive
275
+ `observedThrough` variants as project setup in the dialogue.
276
+ - `check-unavailable` has known root, target version, and nonempty problems
277
+ when the target cannot be resolved, fetched, or materialized; it does not
278
+ pretend the project was checked.
279
+
280
+ There are no `outcomes` or `instructions` keys in a check report. Its default
281
+ human-readable output gives only the target, validation conclusion, and
282
+ problems, not the dialogue's four sections. Text and JSON derive from the same
283
+ validation result. Exit code `0` means `project-ready` and is the **only**
284
+ pre-commit/CI pass condition. Exit code `1` means invalid, unavailable, or an
285
+ internal failure and must fail closed; `2` means invalid CLI usage. Do not
286
+ infer success merely from a rendered report or empty-looking output.
128
287
 
129
288
  Runtime checks verify canonical YAML, fixed paths, the three world entries,
130
- unique aliases, Git object format, tree object types, per-world candidate
131
- revision binding, and acceptance history.
289
+ unique aliases, Git object format, current world tree resolution, and lifecycle
290
+ derivation from the selected snapshot. They do not infer newly made decisions
291
+ from a parent diff or audit decision provenance through history.
132
292
 
133
293
  ## Schemas
134
294
 
@@ -10,8 +10,8 @@ The shared authority is `https://github.com/shazhou-ww/silvermoon.git` on
10
10
  optional transport and are not protocol state.
11
11
 
12
12
  ```sh
13
- silvermoon whats-next [idea] --json
14
- silvermoon create-idea --json
13
+ silvermoon whats-next [idea]
14
+ silvermoon create-idea
15
15
  silvermoon check
16
16
  silvermoon check --worktree
17
17
  silvermoon check --staged
@@ -19,25 +19,31 @@ silvermoon check --commit HEAD
19
19
  silvermoon check --remote
20
20
  ```
21
21
 
22
- Use the report's `observedPrimaryCommit` as the expected remote tip. When
22
+ Use the primary commit stated in the report as the expected remote tip. When
23
23
  primary moves, reobserve instead of replaying approval or acceptance.
24
24
 
25
25
  Choose the entry command from the user's intent. Explicit new-idea requests use
26
- `silvermoon create-idea --json` even when unrelated active ideas exist; all
27
- navigation uses `silvermoon whats-next [idea] --json`. Both commands apply the
28
- same branch, conflict, worktree, and ancestry hygiene. If hygiene blocks an
29
- explicit creation, perform only that blocking action and then retry
30
- `create-idea` so active-idea selection cannot replace the pending create intent.
26
+ `silvermoon create-idea` even when unrelated active ideas exist; all navigation
27
+ uses `silvermoon whats-next [idea]`. Add `--json` only for a programmatic
28
+ consumer. Both commands apply the
29
+ same project checks, but their repository readiness differs. `whats-next`
30
+ checks local hygiene and remote ancestry. `create-idea` requires the configured
31
+ primary branch and upstream plus a clean worktree, without fetching or requiring
32
+ HEAD to match the remote tip. If hygiene blocks explicit creation, perform only
33
+ that blocking action and then retry `create-idea` so active-idea selection
34
+ cannot replace the pending create intent.
31
35
 
32
36
  ## Decisions And Publication
33
37
 
34
- `whats-next` is read-only. Human approvals, implementation acceptance,
35
- deployment acceptance, and abandonment are ordinary edits to one idea
36
- `status.yaml` after an explicit decision. Validate the candidate and publish a
37
- normal non-force commit. Prefer status-only decision commits when practical.
38
+ `whats-next` may fetch after local readiness passes, but it does not move the
39
+ worktree, index, branches, or named refs. Human approvals, implementation
40
+ acceptance, deployment acceptance, and abandonment are ordinary edits to one
41
+ idea `status.yaml` after an explicit decision. Validate the candidate and
42
+ publish a normal non-force commit. Prefer status-only decision commits when
43
+ practical.
38
44
 
39
45
  The required idea-root `ledger.md` is the Agent continuation surface. After
40
- repository hygiene and lifecycle routing, combine the reported action, world
46
+ repository hygiene and lifecycle routing, combine the reported instructions, world
41
47
  contracts, and unchecked Implementation or Deployment ledger entries to infer
42
48
  the next work. Update matching world headings and ledger entries together, and
43
49
  reset a checked item when its requirement or proof changes materially. Ledger
@@ -59,3 +65,9 @@ branches.
59
65
  and `git diff --check` before delivery review.
60
66
  - Use `silvermoon check --commit HEAD` for checked-out CI and
61
67
  `silvermoon check --remote` for complete primary-history evidence.
68
+ - Use `silvermoon check --staged` in pre-commit hooks: default `check` validates
69
+ committed `HEAD`, not the pending index. `check` validates only the chosen
70
+ project's snapshot, not repository synchronization or idea navigation.
71
+ Only exit code `0` permits the commit; `1` means invalid or unavailable and
72
+ `2` means invalid usage. Its JSON contains `intention` and `observation`,
73
+ not dialogue `outcomes` or `instructions`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "silvermoon",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "The project spirit that checks repository state and answers what's next.",
5
5
  "packageManager": "pnpm@11.22.0",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "schema"
22
22
  ],
23
23
  "scripts": {
24
- "check": "npm run lint:markdown && npm run check:quick && npm run test:integration && npm run pack:check && npm run test:e2e && npm run check:skills",
24
+ "check": "node scripts/run-checks.mjs",
25
25
  "check:quick": "node --check bin/silvermoon.js && npm test",
26
26
  "check:skills": "node scripts/sync-skills.mjs --check && npx skills add . --list",
27
27
  "lint:markdown": "markdownlint-cli2",
@@ -29,15 +29,15 @@
29
29
  "const": true
30
30
  },
31
31
  "approvedRevision": {
32
- "description": "Accepted Ideal World (道心) tree object ID.",
32
+ "description": "Accepted Ideal World (理想世界) tree object ID.",
33
33
  "$ref": "definitions.schema.json#/$defs/objectId"
34
34
  },
35
35
  "implementationAcceptedRevision": {
36
- "description": "Accepted Inner World (内景) tree object ID.",
36
+ "description": "Accepted Inner World (主体世界) tree object ID.",
37
37
  "$ref": "definitions.schema.json#/$defs/objectId"
38
38
  },
39
39
  "deploymentAcceptedRevision": {
40
- "description": "Accepted Outer World (现世) tree object ID.",
40
+ "description": "Accepted Outer World (现实世界) tree object ID.",
41
41
  "$ref": "definitions.schema.json#/$defs/objectId"
42
42
  }
43
43
  }