@zalom/plastic 1.0.0-alpha.27 → 1.0.0-alpha.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zalom/plastic",
3
- "version": "1.0.0-alpha.27",
3
+ "version": "1.0.0-alpha.28",
4
4
  "description": "Intent-driven idea development system for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,10 +17,6 @@ require "yaml"
17
17
  module QmdSync
18
18
  module_function
19
19
 
20
- CONTEXT_DESCRIPTION =
21
- "Plastic intent store: intents, specs, plans, checklists, outcomes, and insights " \
22
- "for the What/Why/How/Exec lifecycle. Search here for past decisions and work."
23
-
24
20
  # A runner is `->(args_array) { [stdout_string, success_boolean] }`.
25
21
  # The default invokes the real `qmd` binary.
26
22
  def default_runner
@@ -81,13 +77,16 @@ module QmdSync
81
77
  stores
82
78
  end
83
79
 
84
- # Register a store directory as a collection and attach the Plastic context
85
- # description. Idempotent: re-running is safe. No-op when qmd is absent.
86
- def register(collection:, dir:, runner: default_runner, context: CONTEXT_DESCRIPTION, detector: method(:detect))
80
+ # Register a store directory as a collection. Idempotent: re-running is safe.
81
+ # `qmd collection add` exits non-zero when the collection already exists, so we
82
+ # check the collection list first and treat an existing collection as success.
83
+ # No-op when qmd is absent. (`qmd context add` attaches a summary to a document
84
+ # path, not a collection-level description, so it is not used here.)
85
+ def register(collection:, dir:, runner: default_runner, detector: method(:detect))
87
86
  return skip_result unless detector.call
88
- out1, ok1 = runner.call(["collection", "add", dir, "--name", collection])
89
- _out2, ok2 = runner.call(["context", "add", collection, context])
90
- { ran: true, ok: (ok1 && ok2), output: out1.to_s.strip }
87
+ return { ran: true, ok: true, output: "exists" } if list_collections(runner).include?(collection)
88
+ out, ok = runner.call(["collection", "add", dir, "--name", collection])
89
+ { ran: true, ok: ok, output: out.to_s.strip }
91
90
  end
92
91
 
93
92
  # Re-index a single collection: refresh the corpus then its embeddings.