coherence-cli 0.1.0 → 0.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/README.md +185 -0
- package/README.template.md +165 -0
- package/bin/cc.mjs +15 -6
- package/lib/commands/contribute.mjs +48 -3
- package/lib/commands/ideas.mjs +41 -0
- package/lib/commands/identity.mjs +12 -0
- package/package.json +28 -6
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<!-- AUTO-GENERATED from README.template.md. Edit the template, not this file. -->
|
|
2
|
+
# coherence-cli
|
|
3
|
+
|
|
4
|
+
**Every idea deserves a trail. Every contributor deserves credit.**
|
|
5
|
+
|
|
6
|
+
`cc` is the command-line interface for [Coherence Network](https://coherencycoin.com) — an open intelligence platform that traces every idea from inception to payout, with fair attribution, coherence scoring, and federated trust.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
npm i -g coherence-cli
|
|
10
|
+
cc status
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That's it. You're connected to the live network. No account, no signup, no API key needed for reading.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why this exists
|
|
18
|
+
|
|
19
|
+
Most ideas die in the gap between "great thought" and "shipped thing." The people who research, prototype, review, document, and maintain rarely see proportional credit.
|
|
20
|
+
|
|
21
|
+
Coherence Network changes that. It tracks the full lifecycle:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Idea → Research → Spec → Implementation → Review → Usage → Payout
|
|
25
|
+
↑ ↓
|
|
26
|
+
└────────── coherence scores at every stage ─────────┘
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Every stage is scored for **coherence** (0.0–1.0) — measuring test coverage, documentation quality, and implementation simplicity. Contributors are paid proportionally to the energy they invested and the coherence they achieved.
|
|
30
|
+
|
|
31
|
+
`cc` gives you direct access to all of it from your terminal.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
### See what's happening
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cc ideas # Browse the portfolio ranked by ROI
|
|
41
|
+
cc resonance # What's alive right now
|
|
42
|
+
cc status # Network health, node count, your identity
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Go deeper
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cc idea <id> # Full scores, open questions, value gaps
|
|
49
|
+
cc specs # Feature specs with ROI metrics
|
|
50
|
+
cc spec <id> # Implementation summary, pseudocode, cost
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Contribute
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cc share # Submit a new idea (interactive)
|
|
57
|
+
cc stake <id> 10 # Stake 10 CC on an idea you believe in
|
|
58
|
+
cc fork <id> # Fork an idea and take it a new direction
|
|
59
|
+
cc contribute # Record any contribution (code, docs, review, design, community)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Identity — bring your own
|
|
63
|
+
|
|
64
|
+
Link any identity you already have. No new accounts. 37 providers across 6 categories.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cc identity setup # Guided onboarding (first time)
|
|
68
|
+
cc identity link github alice-dev # Link your GitHub
|
|
69
|
+
cc identity link ethereum 0xabc... # Link your wallet
|
|
70
|
+
cc identity link discord user#1234 # Link Discord
|
|
71
|
+
cc identity # See all your linked accounts
|
|
72
|
+
cc identity lookup github alice-dev # Find anyone by their handle
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Supported providers:**
|
|
76
|
+
|
|
77
|
+
| Category | Providers |
|
|
78
|
+
|----------|-----------|
|
|
79
|
+
| **Social** | X, Discord, Telegram, Mastodon, Bluesky, Reddit, YouTube, Twitch, Instagram, TikTok, Fediverse |
|
|
80
|
+
| **Developer** | GitHub, GitLab, Bitbucket, npm, crates.io, PyPI, Hacker News, Stack Overflow |
|
|
81
|
+
| **Crypto / Web3** | Ethereum, Bitcoin, Solana, Cosmos, Nostr, ENS, Lens |
|
|
82
|
+
| **Professional** | LinkedIn, ORCID |
|
|
83
|
+
| **Identity** | Email, Google, Apple, Microsoft, DID, Keybase, PGP |
|
|
84
|
+
| **Platform** | OpenClaw |
|
|
85
|
+
|
|
86
|
+
You don't need to register anywhere. Just link a provider and start contributing — your work is attributed to your identity across the entire network.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## How coherence scoring works
|
|
91
|
+
|
|
92
|
+
Every contribution and every idea is scored on a 0.0–1.0 scale:
|
|
93
|
+
|
|
94
|
+
- **1.0** — Tests pass, docs are clear, implementation is simple, value is proven
|
|
95
|
+
- **0.5** — Partial coverage, some gaps, work in progress
|
|
96
|
+
- **0.0** — No tests, no docs, no evidence of value
|
|
97
|
+
|
|
98
|
+
The score isn't a grade — it's a signal. It tells you and the network how much energy has been invested and how much trust the work has earned. Payouts are weighted by coherence, so higher-quality contributions earn proportionally more.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## The five pillars
|
|
103
|
+
|
|
104
|
+
| Pillar | In practice |
|
|
105
|
+
|--------|-------------|
|
|
106
|
+
| **Traceability** | `cc idea <id>` traces from spark to payout. Nothing is lost. |
|
|
107
|
+
| **Trust** | Coherence scores replace subjective judgement with measurable quality. |
|
|
108
|
+
| **Freedom** | Fork any idea. Run your own node. Vote on governance. No gatekeepers. |
|
|
109
|
+
| **Uniqueness** | Every idea, spec, and contribution is uniquely identified and ranked. |
|
|
110
|
+
| **Collaboration** | Multi-contributor attribution with coherence-weighted payouts. Fair by design. |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## The Coherence Network ecosystem
|
|
115
|
+
|
|
116
|
+
Every part of the network links to every other. Jump in wherever makes sense for you.
|
|
117
|
+
|
|
118
|
+
| Surface | What it is | Link |
|
|
119
|
+
|---------|-----------|------|
|
|
120
|
+
| **Web** | The main site — browse ideas, specs, and contributors visually | [coherencycoin.com](https://coherencycoin.com) |
|
|
121
|
+
| **API** | 100+ endpoints, full OpenAPI docs, the engine behind everything | [api.coherencycoin.com/docs](https://api.coherencycoin.com/docs) |
|
|
122
|
+
| **CLI** | This package — terminal-first access to the full network | [npm: coherence-cli](https://www.npmjs.com/package/coherence-cli) |
|
|
123
|
+
| **MCP Server** | 20 typed tools for AI agents (Claude, Cursor, Windsurf, etc.) | [npm: coherence-mcp-server](https://www.npmjs.com/package/coherence-mcp-server) |
|
|
124
|
+
| **OpenClaw Skill** | Auto-triggers in any OpenClaw instance when you mention ideas, specs, or coherence | [ClawHub: coherence-network](https://clawhub.com/skills/coherence-network) |
|
|
125
|
+
| **GitHub** | Source code, specs, issues, and contribution tracking | [github.com/seeker71/Coherence-Network](https://github.com/seeker71/Coherence-Network) |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
By default, `cc` talks to the public API at `https://api.coherencycoin.com`. Override with environment variables:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Point to a local node
|
|
135
|
+
export COHERENCE_API_URL=http://localhost:8000
|
|
136
|
+
|
|
137
|
+
# Enable write operations
|
|
138
|
+
export COHERENCE_API_KEY=your-key
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Config is stored in `~/.coherence-network/config.json`.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## All commands
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
cc help Show all commands
|
|
149
|
+
cc ideas [limit] Browse ideas by ROI
|
|
150
|
+
cc idea <id> View idea detail with scores
|
|
151
|
+
cc specs [limit] List feature specs
|
|
152
|
+
cc spec <id> View spec detail
|
|
153
|
+
cc share Submit a new idea
|
|
154
|
+
cc stake <id> <cc> Stake CC on an idea
|
|
155
|
+
cc fork <id> Fork an idea
|
|
156
|
+
cc contribute Record any contribution
|
|
157
|
+
cc resonance What's alive right now
|
|
158
|
+
cc status Network health + node info
|
|
159
|
+
cc identity Show linked accounts
|
|
160
|
+
cc identity setup Guided identity onboarding
|
|
161
|
+
cc identity link <provider> <id> Link a provider identity
|
|
162
|
+
cc identity unlink <provider> Unlink a provider
|
|
163
|
+
cc identity lookup <provider> <id> Find contributor by identity
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Get involved
|
|
169
|
+
|
|
170
|
+
Coherence Network is open source. Every contribution is tracked and attributed — yours will be too.
|
|
171
|
+
|
|
172
|
+
The simplest way to start:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
cc ideas # find something interesting
|
|
176
|
+
cc contribute # record what you did
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Or explore any part of the ecosystem from the table above. Every surface leads to every other.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# coherence-cli
|
|
2
|
+
|
|
3
|
+
**Every idea deserves a trail. Every contributor deserves credit.**
|
|
4
|
+
|
|
5
|
+
`cc` is the command-line interface for [Coherence Network](https://coherencycoin.com) — an open intelligence platform that traces every idea from inception to payout, with fair attribution, coherence scoring, and federated trust.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i -g coherence-cli
|
|
9
|
+
cc status
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
That's it. You're connected to the live network. No account, no signup, no API key needed for reading.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Why this exists
|
|
17
|
+
|
|
18
|
+
Most ideas die in the gap between "great thought" and "shipped thing." The people who research, prototype, review, document, and maintain rarely see proportional credit.
|
|
19
|
+
|
|
20
|
+
Coherence Network changes that. It tracks the full lifecycle:
|
|
21
|
+
|
|
22
|
+
<!-- include: docs/shared/lifecycle-diagram.md -->
|
|
23
|
+
|
|
24
|
+
`cc` gives you direct access to all of it from your terminal.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
### See what's happening
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cc ideas # Browse the portfolio ranked by ROI
|
|
34
|
+
cc resonance # What's alive right now
|
|
35
|
+
cc status # Network health, node count, your identity
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Go deeper
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cc idea <id> # Full scores, open questions, value gaps
|
|
42
|
+
cc specs # Feature specs with ROI metrics
|
|
43
|
+
cc spec <id> # Implementation summary, pseudocode, cost
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Contribute
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cc share # Submit a new idea (interactive)
|
|
50
|
+
cc stake <id> 10 # Stake 10 CC on an idea you believe in
|
|
51
|
+
cc fork <id> # Fork an idea and take it a new direction
|
|
52
|
+
cc contribute # Record any contribution (code, docs, review, design, community)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Identity — bring your own
|
|
56
|
+
|
|
57
|
+
Link any identity you already have. No new accounts. 37 providers across 6 categories.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cc identity setup # Guided onboarding (first time)
|
|
61
|
+
cc identity link github alice-dev # Link your GitHub
|
|
62
|
+
cc identity link ethereum 0xabc... # Link your wallet
|
|
63
|
+
cc identity link discord user#1234 # Link Discord
|
|
64
|
+
cc identity # See all your linked accounts
|
|
65
|
+
cc identity lookup github alice-dev # Find anyone by their handle
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Supported providers:**
|
|
69
|
+
|
|
70
|
+
<!-- include: docs/shared/identity-providers.md -->
|
|
71
|
+
|
|
72
|
+
You don't need to register anywhere. Just link a provider and start contributing — your work is attributed to your identity across the entire network.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## How coherence scoring works
|
|
77
|
+
|
|
78
|
+
<!-- include: docs/shared/coherence-scoring.md -->
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## The five pillars
|
|
83
|
+
|
|
84
|
+
| Pillar | In practice |
|
|
85
|
+
|--------|-------------|
|
|
86
|
+
| **Traceability** | `cc idea <id>` traces from spark to payout. Nothing is lost. |
|
|
87
|
+
| **Trust** | Coherence scores replace subjective judgement with measurable quality. |
|
|
88
|
+
| **Freedom** | Fork any idea. Run your own node. Vote on governance. No gatekeepers. |
|
|
89
|
+
| **Uniqueness** | Every idea, spec, and contribution is uniquely identified and ranked. |
|
|
90
|
+
| **Collaboration** | Multi-contributor attribution with coherence-weighted payouts. Fair by design. |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## The Coherence Network ecosystem
|
|
95
|
+
|
|
96
|
+
Every part of the network links to every other. Jump in wherever makes sense for you.
|
|
97
|
+
|
|
98
|
+
| Surface | What it is | Link |
|
|
99
|
+
|---------|-----------|------|
|
|
100
|
+
| **Web** | The main site — browse ideas, specs, and contributors visually | [coherencycoin.com](https://coherencycoin.com) |
|
|
101
|
+
| **API** | 100+ endpoints, full OpenAPI docs, the engine behind everything | [api.coherencycoin.com/docs](https://api.coherencycoin.com/docs) |
|
|
102
|
+
| **CLI** | This package — terminal-first access to the full network | [npm: coherence-cli](https://www.npmjs.com/package/coherence-cli) |
|
|
103
|
+
| **MCP Server** | 20 typed tools for AI agents (Claude, Cursor, Windsurf, etc.) | [npm: coherence-mcp-server](https://www.npmjs.com/package/coherence-mcp-server) |
|
|
104
|
+
| **OpenClaw Skill** | Auto-triggers in any OpenClaw instance when you mention ideas, specs, or coherence | [ClawHub: coherence-network](https://clawhub.com/skills/coherence-network) |
|
|
105
|
+
| **GitHub** | Source code, specs, issues, and contribution tracking | [github.com/seeker71/Coherence-Network](https://github.com/seeker71/Coherence-Network) |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
By default, `cc` talks to the public API at `https://api.coherencycoin.com`. Override with environment variables:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Point to a local node
|
|
115
|
+
export COHERENCE_API_URL=http://localhost:8000
|
|
116
|
+
|
|
117
|
+
# Enable write operations
|
|
118
|
+
export COHERENCE_API_KEY=your-key
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Config is stored in `~/.coherence-network/config.json`.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## All commands
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
cc help Show all commands
|
|
129
|
+
cc ideas [limit] Browse ideas by ROI
|
|
130
|
+
cc idea <id> View idea detail with scores
|
|
131
|
+
cc specs [limit] List feature specs
|
|
132
|
+
cc spec <id> View spec detail
|
|
133
|
+
cc share Submit a new idea
|
|
134
|
+
cc stake <id> <cc> Stake CC on an idea
|
|
135
|
+
cc fork <id> Fork an idea
|
|
136
|
+
cc contribute Record any contribution
|
|
137
|
+
cc resonance What's alive right now
|
|
138
|
+
cc status Network health + node info
|
|
139
|
+
cc identity Show linked accounts
|
|
140
|
+
cc identity setup Guided identity onboarding
|
|
141
|
+
cc identity link <provider> <id> Link a provider identity
|
|
142
|
+
cc identity unlink <provider> Unlink a provider
|
|
143
|
+
cc identity lookup <provider> <id> Find contributor by identity
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Get involved
|
|
149
|
+
|
|
150
|
+
Coherence Network is open source. Every contribution is tracked and attributed — yours will be too.
|
|
151
|
+
|
|
152
|
+
The simplest way to start:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
cc ideas # find something interesting
|
|
156
|
+
cc contribute # record what you did
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Or explore any part of the ecosystem from the table above. Every surface leads to every other.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT
|
package/bin/cc.mjs
CHANGED
|
@@ -7,29 +7,34 @@
|
|
|
7
7
|
* Zero dependencies. Node 18+ required.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { listIdeas, showIdea, shareIdea, stakeOnIdea, forkIdea } from "../lib/commands/ideas.mjs";
|
|
10
|
+
import { listIdeas, showIdea, shareIdea, stakeOnIdea, forkIdea, createIdea } from "../lib/commands/ideas.mjs";
|
|
11
11
|
import { listSpecs, showSpec } from "../lib/commands/specs.mjs";
|
|
12
12
|
import { contribute } from "../lib/commands/contribute.mjs";
|
|
13
13
|
import { showStatus, showResonance } from "../lib/commands/status.mjs";
|
|
14
|
-
import { showIdentity, linkIdentity, unlinkIdentity, lookupIdentity, setupIdentity } from "../lib/commands/identity.mjs";
|
|
14
|
+
import { showIdentity, linkIdentity, unlinkIdentity, lookupIdentity, setupIdentity, setIdentity } from "../lib/commands/identity.mjs";
|
|
15
15
|
|
|
16
16
|
const [command, ...args] = process.argv.slice(2);
|
|
17
17
|
|
|
18
18
|
const COMMANDS = {
|
|
19
19
|
ideas: () => listIdeas(args),
|
|
20
|
-
idea: () =>
|
|
20
|
+
idea: () => handleIdea(args),
|
|
21
21
|
share: () => shareIdea(),
|
|
22
22
|
stake: () => stakeOnIdea(args),
|
|
23
23
|
fork: () => forkIdea(args),
|
|
24
24
|
specs: () => listSpecs(args),
|
|
25
25
|
spec: () => showSpec(args),
|
|
26
|
-
contribute: () => contribute(),
|
|
26
|
+
contribute: () => contribute(args),
|
|
27
27
|
status: () => showStatus(),
|
|
28
28
|
resonance: () => showResonance(),
|
|
29
29
|
identity: () => handleIdentity(args),
|
|
30
30
|
help: () => showHelp(),
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
async function handleIdea(args) {
|
|
34
|
+
if (args[0] === "create") return createIdea(args.slice(1));
|
|
35
|
+
return showIdea(args);
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
async function handleIdentity(args) {
|
|
34
39
|
const sub = args[0];
|
|
35
40
|
const subArgs = args.slice(1);
|
|
@@ -38,6 +43,7 @@ async function handleIdentity(args) {
|
|
|
38
43
|
case "unlink": return unlinkIdentity(subArgs);
|
|
39
44
|
case "lookup": return lookupIdentity(subArgs);
|
|
40
45
|
case "setup": return setupIdentity();
|
|
46
|
+
case "set": return setIdentity(subArgs);
|
|
41
47
|
default: return showIdentity();
|
|
42
48
|
}
|
|
43
49
|
}
|
|
@@ -51,20 +57,23 @@ function showHelp() {
|
|
|
51
57
|
\x1b[1mExplore:\x1b[0m
|
|
52
58
|
ideas [limit] Browse ideas by ROI
|
|
53
59
|
idea <id> View idea detail
|
|
60
|
+
idea create <id> <name> [--desc "..." --value N --cost N --parent <id>]
|
|
54
61
|
specs [limit] List feature specs
|
|
55
62
|
spec <id> View spec detail
|
|
56
63
|
resonance What's alive right now
|
|
57
64
|
status Network health + node info
|
|
58
65
|
|
|
59
66
|
\x1b[1mContribute:\x1b[0m
|
|
60
|
-
share Submit a new idea
|
|
67
|
+
share Submit a new idea (interactive)
|
|
68
|
+
contribute Record contribution (interactive)
|
|
69
|
+
contribute --type code --cc 5 --idea <id> --desc "what I did"
|
|
61
70
|
stake <id> <cc> Stake CC on an idea
|
|
62
71
|
fork <id> Fork an idea
|
|
63
|
-
contribute Record any contribution
|
|
64
72
|
|
|
65
73
|
\x1b[1mIdentity:\x1b[0m
|
|
66
74
|
identity Show your linked accounts
|
|
67
75
|
identity setup Guided onboarding
|
|
76
|
+
identity set <id> Set identity non-interactively
|
|
68
77
|
identity link <p> <id> Link a provider (github, discord, ethereum, ...)
|
|
69
78
|
identity unlink <p> Unlink a provider
|
|
70
79
|
identity lookup <p> <id> Find contributor by identity
|
|
@@ -1,14 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contribute command — record any contribution.
|
|
3
|
+
*
|
|
4
|
+
* Interactive: cc contribute
|
|
5
|
+
* Non-interactive (for agents):
|
|
6
|
+
* cc contribute --type code --cc 5 --idea <id> --desc "what I did"
|
|
3
7
|
*/
|
|
4
8
|
|
|
5
9
|
import { post } from "../api.mjs";
|
|
6
10
|
import { ensureIdentity } from "../identity.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { stdin, stdout } from "node:process";
|
|
11
|
+
import { getContributorId } from "../config.mjs";
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
function parseFlags(args) {
|
|
14
|
+
const flags = {};
|
|
15
|
+
for (let i = 0; i < args.length; i++) {
|
|
16
|
+
if (args[i] === "--type" && args[i + 1]) flags.type = args[++i];
|
|
17
|
+
else if (args[i] === "--cc" && args[i + 1]) flags.cc = parseFloat(args[++i]);
|
|
18
|
+
else if (args[i] === "--idea" && args[i + 1]) flags.idea = args[++i];
|
|
19
|
+
else if (args[i] === "--desc" && args[i + 1]) flags.desc = args[++i];
|
|
20
|
+
}
|
|
21
|
+
return flags;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function contribute(args = []) {
|
|
25
|
+
const flags = parseFlags(args);
|
|
26
|
+
const hasFlags = flags.type || flags.cc || flags.idea || flags.desc;
|
|
27
|
+
|
|
28
|
+
if (hasFlags) {
|
|
29
|
+
// Non-interactive mode (for agents and scripts)
|
|
30
|
+
const contributor = getContributorId() || process.env.COHERENCE_CONTRIBUTOR || "anonymous";
|
|
31
|
+
const type = flags.type || "other";
|
|
32
|
+
const amount = flags.cc || 1.0;
|
|
33
|
+
const ideaId = flags.idea || undefined;
|
|
34
|
+
const description = flags.desc || "";
|
|
35
|
+
|
|
36
|
+
const result = await post("/api/contributions/record", {
|
|
37
|
+
contributor_id: contributor,
|
|
38
|
+
type,
|
|
39
|
+
amount_cc: amount,
|
|
40
|
+
idea_id: ideaId,
|
|
41
|
+
metadata: { description },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (result) {
|
|
45
|
+
console.log(`\x1b[32m✓\x1b[0m ${type} ${amount} CC${ideaId ? ` → ${ideaId}` : ""}${description ? ` (${description})` : ""}`);
|
|
46
|
+
} else {
|
|
47
|
+
console.log("Failed to record contribution.");
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Interactive mode
|
|
11
54
|
const contributor = await ensureIdentity();
|
|
55
|
+
const { createInterface } = await import("node:readline/promises");
|
|
56
|
+
const { stdin, stdout } = await import("node:process");
|
|
12
57
|
const rl = createInterface({ input: stdin, output: stdout });
|
|
13
58
|
|
|
14
59
|
console.log();
|
package/lib/commands/ideas.mjs
CHANGED
|
@@ -136,3 +136,44 @@ export async function forkIdea(args) {
|
|
|
136
136
|
console.log("Fork failed.");
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Non-interactive idea creation for agents and scripts.
|
|
142
|
+
*
|
|
143
|
+
* Usage: cc idea create <id> <name> [--desc "..."] [--value N] [--cost N] [--parent <id>]
|
|
144
|
+
*/
|
|
145
|
+
export async function createIdea(args) {
|
|
146
|
+
if (args.length < 2) {
|
|
147
|
+
console.log("Usage: cc idea create <id> <name> [--desc \"...\"] [--value N] [--cost N] [--parent <id>]");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const id = args[0];
|
|
152
|
+
const name = args[1];
|
|
153
|
+
const flags = {};
|
|
154
|
+
for (let i = 2; i < args.length; i++) {
|
|
155
|
+
if (args[i] === "--desc" && args[i + 1]) flags.desc = args[++i];
|
|
156
|
+
else if (args[i] === "--value" && args[i + 1]) flags.value = parseFloat(args[++i]);
|
|
157
|
+
else if (args[i] === "--cost" && args[i + 1]) flags.cost = parseFloat(args[++i]);
|
|
158
|
+
else if (args[i] === "--parent" && args[i + 1]) flags.parent = args[++i];
|
|
159
|
+
else if (args[i] === "--confidence" && args[i + 1]) flags.confidence = parseFloat(args[++i]);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const body = {
|
|
163
|
+
id,
|
|
164
|
+
name,
|
|
165
|
+
description: flags.desc || name,
|
|
166
|
+
potential_value: flags.value || 50,
|
|
167
|
+
estimated_cost: flags.cost || 5,
|
|
168
|
+
confidence: flags.confidence || 0.5,
|
|
169
|
+
};
|
|
170
|
+
if (flags.parent) body.parent_idea_id = flags.parent;
|
|
171
|
+
|
|
172
|
+
const result = await post("/api/ideas", body);
|
|
173
|
+
if (result) {
|
|
174
|
+
console.log(`\x1b[32m✓\x1b[0m Idea created: ${result.id || id}`);
|
|
175
|
+
} else {
|
|
176
|
+
console.log("Failed to create idea.");
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -86,6 +86,18 @@ export async function lookupIdentity(args) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
export async function setIdentity(args) {
|
|
90
|
+
const id = args[0];
|
|
91
|
+
if (!id) {
|
|
92
|
+
console.log("Usage: cc identity set <contributor_id>");
|
|
93
|
+
console.log("Sets the contributor identity non-interactively (for agents and scripts).");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const { saveConfig } = await import("../config.mjs");
|
|
97
|
+
saveConfig({ contributor_id: id });
|
|
98
|
+
console.log(`\x1b[32m✓\x1b[0m Identity set to: ${id}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
89
101
|
export async function setupIdentity() {
|
|
90
102
|
// Force re-run onboarding
|
|
91
103
|
await ensureIdentity();
|
package/package.json
CHANGED
|
@@ -1,28 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coherence-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Coherence Network CLI —
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Coherence Network CLI — trace ideas from inception to payout, with fair attribution, coherence scoring, and 37 identity providers. No signup needed.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"cc": "bin/cc.mjs"
|
|
7
|
+
"cc": "bin/cc.mjs",
|
|
8
|
+
"coh": "bin/cc.mjs",
|
|
9
|
+
"coherence": "bin/cc.mjs"
|
|
8
10
|
},
|
|
9
11
|
"engines": {
|
|
10
12
|
"node": ">=18.0.0"
|
|
11
13
|
},
|
|
12
14
|
"files": [
|
|
13
15
|
"bin/",
|
|
14
|
-
"lib/"
|
|
16
|
+
"lib/",
|
|
17
|
+
"README.md"
|
|
15
18
|
],
|
|
16
19
|
"keywords": [
|
|
17
20
|
"coherence",
|
|
21
|
+
"coherence-network",
|
|
18
22
|
"contribution",
|
|
19
23
|
"attribution",
|
|
20
24
|
"identity",
|
|
21
|
-
"cli"
|
|
25
|
+
"cli",
|
|
26
|
+
"ideas",
|
|
27
|
+
"specs",
|
|
28
|
+
"roi",
|
|
29
|
+
"open-source",
|
|
30
|
+
"fair-attribution",
|
|
31
|
+
"value-chain",
|
|
32
|
+
"traceability",
|
|
33
|
+
"staking",
|
|
34
|
+
"federation",
|
|
35
|
+
"governance",
|
|
36
|
+
"mcp",
|
|
37
|
+
"ai-agent",
|
|
38
|
+
"openclaw"
|
|
22
39
|
],
|
|
23
40
|
"license": "MIT",
|
|
41
|
+
"homepage": "https://coherencycoin.com",
|
|
24
42
|
"repository": {
|
|
25
43
|
"type": "git",
|
|
26
44
|
"url": "git+https://github.com/seeker71/Coherence-Network.git"
|
|
27
|
-
}
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/seeker71/Coherence-Network/issues"
|
|
48
|
+
},
|
|
49
|
+
"author": "Coherence Network Contributors"
|
|
28
50
|
}
|